Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit

Permalink
First commit after separation from zk
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaskov committed Nov 30, 2020
0 parents commit 54537c8
Show file tree
Hide file tree
Showing 71 changed files with 14,591 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
BasedOnStyle: WebKit
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakAfterJavaFieldAnnotations: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakStringLiterals: true
ColumnLimit: 120
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: true
FixNamespaceComments: true
ForEachMacros: [ 'BOOST_FOREACH' ]
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"(<)/'
Priority: 1
- Regex: '^(<(boost)/)'
Priority: 2
- Regex: '^(<(nil\/algebra)/)'
Priority: 3
- Regex: '.*'
Priority: 4
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
Language: Cpp
NamespaceIndentation: All
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 4
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never

...
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "cmake/modules"]
path = cmake/modules
url = https://github.com/BoostCMake/cmake_modules.git
250 changes: 250 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
cmake_minimum_required(VERSION 2.8.11)

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)

if(NOT CMAKE_WORKSPACE_NAME OR NOT ("${CMAKE_WORKSPACE_NAME}" STREQUAL "crypto3"))
cm_workspace(crypto3)
endif()

macro(cm_find_package NAME)
foreach(ITERATOR ${CMAKE_WORKSPACE_LIST})
if(NOT "${NAME}" MATCHES "^${ITERATOR}_.*$" AND NOT "${NAME}" STREQUAL CM)
find_package(${ARGV})
else()
set(${ARGV0}_FOUND ON CACHE BOOL "")
endif()
endforeach()
endmacro()

cm_project(blueprint WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES C CXX)

cm_find_package(CM)
include(CMDeploy)
include(FindPkgConfig)

option(BUILD_WITH_CCACHE "Build with ccache usage" TRUE)
option(BUILD_WITH_PROCPS "Build with procps for memory profiling" TRUE)
option(BUILD_TESTS "Build unit tests" FALSE)

if(UNIX AND BUILD_WITH_CCACHE)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
endif()

if(UNIX AND BUILD_WITH_PROCPS)
find_package(Procps)
endif()

list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
include/nil/crypto3/zk/snark/accumulators/snark.hpp

include/nil/crypto3/zk/snark/detail/accumulation_vector.hpp
include/nil/crypto3/zk/snark/detail/set_commitment.hpp
include/nil/crypto3/zk/snark/detail/sparse_vector.hpp

include/nil/crypto3/zk/snark/components/cpu_checkers/fooram/components/bar_component.hpp
include/nil/crypto3/zk/snark/components/cpu_checkers/fooram/components/fooram_blueprint.hpp
include/nil/crypto3/zk/snark/components/cpu_checkers/fooram/fooram_cpu_checker.hpp

include/nil/crypto3/zk/snark/components/cpu_checkers/tinyram/components/alu_arithmetic.hpp
include/nil/crypto3/zk/snark/components/cpu_checkers/tinyram/components/alu_control_flow.hpp
include/nil/crypto3/zk/snark/components/cpu_checkers/tinyram/components/alu_component.hpp
include/nil/crypto3/zk/snark/components/cpu_checkers/tinyram/components/argument_decoder_component.hpp
include/nil/crypto3/zk/snark/components/cpu_checkers/tinyram/components/consistency_enforcer_component.hpp
include/nil/crypto3/zk/snark/components/cpu_checkers/tinyram/components/memory_masking_component.hpp
include/nil/crypto3/zk/snark/components/cpu_checkers/tinyram/components/tinyram_blueprint.hpp
include/nil/crypto3/zk/snark/components/cpu_checkers/tinyram/components/word_variable_component.hpp
include/nil/crypto3/zk/snark/components/cpu_checkers/tinyram/tinyram_cpu_checker.hpp

include/nil/crypto3/zk/snark/components/curves/weierstrass_g1_component.hpp
include/nil/crypto3/zk/snark/components/curves/weierstrass_g2_component.hpp

include/nil/crypto3/zk/snark/components/delegated_ra_memory/memory_load_component.hpp
include/nil/crypto3/zk/snark/components/delegated_ra_memory/memory_load_store_component.hpp

include/nil/crypto3/zk/snark/components/fields/exponentiation_component.hpp
include/nil/crypto3/zk/snark/components/fields/fp2_components.hpp
include/nil/crypto3/zk/snark/components/fields/fp3_components.hpp
include/nil/crypto3/zk/snark/components/fields/fp4_components.hpp
include/nil/crypto3/zk/snark/components/fields/fp6_components.hpp

include/nil/crypto3/zk/snark/components/hashes/knapsack/knapsack_component.hpp

include/nil/crypto3/zk/snark/components/hashes/sha256/sha256_aux.hpp
include/nil/crypto3/zk/snark/components/hashes/sha256/sha256_components.hpp
include/nil/crypto3/zk/snark/components/hashes/sha256/sha256_component.hpp

include/nil/crypto3/zk/snark/components/hashes/crh_component.hpp
include/nil/crypto3/zk/snark/components/hashes/digest_selector_component.hpp
include/nil/crypto3/zk/snark/components/hashes/hash_io.hpp

include/nil/crypto3/zk/snark/components/merkle_tree/merkle_authentication_path_variable.hpp
include/nil/crypto3/zk/snark/components/merkle_tree/merkle_tree_check_read_component.hpp
include/nil/crypto3/zk/snark/components/merkle_tree/merkle_tree_check_update_component.hpp

include/nil/crypto3/zk/snark/components/pairing/mnt_pairing_params.hpp
include/nil/crypto3/zk/snark/components/pairing/pairing_checks.hpp
include/nil/crypto3/zk/snark/components/pairing/pairing_params.hpp
include/nil/crypto3/zk/snark/components/pairing/weierstrass_final_exponentiation.hpp
include/nil/crypto3/zk/snark/components/pairing/weierstrass_miller_loop.hpp
include/nil/crypto3/zk/snark/components/pairing/as_waksman.hpp

include/nil/crypto3/zk/snark/components/routing/as_waksman_routing_component.hpp
include/nil/crypto3/zk/snark/components/routing/benes_routing_component.hpp

include/nil/crypto3/zk/snark/components/set_commitment/set_commitment_component.hpp
include/nil/crypto3/zk/snark/components/set_commitment/set_membership_proof_variable.hpp

include/nil/crypto3/zk/snark/components/verifiers/r1cs_ppzksnark_verifier_component.hpp
include/nil/crypto3/zk/snark/components/basic_components.hpp
include/nil/crypto3/zk/snark/components/component_from_r1cs.hpp

include/nil/crypto3/zk/snark/knowledge_commitment/kc_multiexp.hpp
include/nil/crypto3/zk/snark/knowledge_commitment/knowledge_commitment.hpp

include/nil/crypto3/zk/snark/proof_systems/pcd/r1cs_pcd/compliance_predicate/compliance_predicate.hpp
include/nil/crypto3/zk/snark/proof_systems/pcd/r1cs_pcd/compliance_predicate/cp_handler.hpp

include/nil/crypto3/zk/snark/proof_systems/pcd/r1cs_pcd/r1cs_mp_ppzkpcd/mp_pcd_circuits.hpp
include/nil/crypto3/zk/snark/proof_systems/pcd/r1cs_pcd/r1cs_mp_ppzkpcd/r1cs_mp_ppzkpcd.hpp
include/nil/crypto3/zk/snark/proof_systems/pcd/r1cs_pcd/r1cs_mp_ppzkpcd/r1cs_mp_ppzkpcd_params.hpp

include/nil/crypto3/zk/snark/proof_systems/pcd/r1cs_pcd/r1cs_sp_ppzkpcd/r1cs_sp_ppzkpcd.hpp
include/nil/crypto3/zk/snark/proof_systems/pcd/r1cs_pcd/r1cs_sp_ppzkpcd/r1cs_sp_ppzkpcd_params.hpp
include/nil/crypto3/zk/snark/proof_systems/pcd/r1cs_pcd/r1cs_sp_ppzkpcd/sp_pcd_circuits.hpp
include/nil/crypto3/zk/snark/proof_systems/pcd/r1cs_pcd/ppzkpcd_compliance_predicate.hpp
include/nil/crypto3/zk/snark/proof_systems/pcd/r1cs_pcd/r1cs_pcd_params.hpp

include/nil/crypto3/zk/snark/proof_systems/ppzkadsnark/r1cs_ppzkadsnark/r1cs_ppzkadsnark.hpp
include/nil/crypto3/zk/snark/proof_systems/ppzkadsnark/r1cs_ppzkadsnark/prf.hpp
include/nil/crypto3/zk/snark/proof_systems/ppzkadsnark/r1cs_ppzkadsnark/signature.hpp
include/nil/crypto3/zk/snark/proof_systems/detail/ppzkadsnark/r1cs_ppzkadsnark/basic_policy.hpp

include/nil/crypto3/zk/snark/proof_systems/ppzksnark/bacs_ppzksnark.hpp
include/nil/crypto3/zk/snark/proof_systems/detail/ppzksnark/bacs_ppzksnark/basic_policy.hpp

include/nil/crypto3/zk/snark/proof_systems/ppzksnark/r1cs_gg_ppzksnark.hpp
include/nil/crypto3/zk/snark/proof_systems/detail/ppzksnark/r1cs_gg_ppzksnark/basic_policy.hpp

include/nil/crypto3/zk/snark/proof_systems/ppzksnark/r1cs_ppzksnark.hpp
include/nil/crypto3/zk/snark/proof_systems/detail/ppzksnark/r1cs_ppzksnark/basic_policy.hpp

include/nil/crypto3/zk/snark/proof_systems/ppzksnark/r1cs_se_ppzksnark.hpp
include/nil/crypto3/zk/snark/proof_systems/detail/ppzksnark/r1cs_se_ppzksnark/basic_policy.hpp

include/nil/crypto3/zk/snark/proof_systems/ppzksnark/tbcs_ppzksnark.hpp
include/nil/crypto3/zk/snark/proof_systems/detail/ppzksnark/tbcs_ppzksnark/basic_policy.hpp

include/nil/crypto3/zk/snark/proof_systems/ppzksnark/uscs_ppzksnark.hpp
include/nil/crypto3/zk/snark/proof_systems/detail/ppzksnark/uscs_ppzksnark/basic_policy.hpp

include/nil/crypto3/zk/snark/reductions/bacs_to_r1cs.hpp

include/nil/crypto3/zk/snark/reductions/r1cs_to_qap.hpp

include/nil/crypto3/zk/snark/reductions/r1cs_to_sap.hpp

include/nil/crypto3/zk/snark/reductions/ram_to_r1cs/components/memory_checker_component.hpp
include/nil/crypto3/zk/snark/reductions/ram_to_r1cs/components/ram_universal_component.hpp
include/nil/crypto3/zk/snark/reductions/ram_to_r1cs/components/trace_lines.hpp
include/nil/crypto3/zk/snark/reductions/ram_to_r1cs/ram_to_r1cs.hpp

include/nil/crypto3/zk/snark/reductions/tbcs_to_uscs.hpp

include/nil/crypto3/zk/snark/reductions/uscs_to_ssp.hpp

include/nil/crypto3/zk/snark/relations/arithmetic_programs/qap.hpp

include/nil/crypto3/zk/snark/relations/arithmetic_programs/sap.hpp

include/nil/crypto3/zk/snark/relations/arithmetic_programs/ssp.hpp

include/nil/crypto3/zk/snark/relations/circuit_satisfaction_problems/bacs.hpp

include/nil/crypto3/zk/snark/relations/circuit_satisfaction_problems/tbcs.hpp

include/nil/crypto3/zk/snark/relations/constraint_satisfaction_problems/r1cs.hpp

include/nil/crypto3/zk/snark/relations/constraint_satisfaction_problems/uscs.hpp

include/nil/crypto3/zk/snark/relations/ram_computations/memory/delegated_ra_memory.hpp
include/nil/crypto3/zk/snark/relations/ram_computations/memory/memory_interface.hpp
include/nil/crypto3/zk/snark/relations/ram_computations/memory/memory_store_trace.hpp
include/nil/crypto3/zk/snark/relations/ram_computations/memory/ra_memory.hpp

include/nil/crypto3/zk/snark/relations/ram_computations/rams/fooram/fooram_aux.hpp
include/nil/crypto3/zk/snark/relations/ram_computations/rams/fooram/fooram_params.hpp

include/nil/crypto3/zk/snark/relations/ram_computations/rams/tinyram/tinyram_aux.hpp
include/nil/crypto3/zk/snark/relations/ram_computations/rams/tinyram/tinyram_params.hpp
include/nil/crypto3/zk/snark/relations/ram_computations/rams/ram_params.hpp
include/nil/crypto3/zk/snark/relations/variable.hpp
include/nil/crypto3/zk/snark/routing/as_waksman.hpp
include/nil/crypto3/zk/snark/routing/benes.hpp
include/nil/crypto3/zk/snark/constraint_profiling.hpp
include/nil/crypto3/zk/snark/component.hpp
include/nil/crypto3/zk/snark/integer_permutation.hpp
include/nil/crypto3/zk/snark/merkle_tree.hpp
include/nil/crypto3/zk/snark/blueprint_variable.hpp
include/nil/crypto3/zk/snark/blueprint.hpp)

list(APPEND ${CURRENT_PROJECT_NAME}_UNGROUPED_SOURCES)

list(APPEND ${CURRENT_PROJECT_NAME}_HEADERS ${${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS})

list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES ${${CURRENT_PROJECT_NAME}_UNGROUPED_SOURCES})

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

add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)

set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>"

${Boost_INCLUDE_DIRS})

if(PROCPS_FOUND)
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
"${CMAKE_UPPER_WORKSPACE_NAME}_HAS_PROCPS")
endif()

target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE

${Boost_LIBRARIES}

${CMAKE_WORKSPACE_NAME}::algebra
${CMAKE_WORKSPACE_NAME}::fft
${CMAKE_WORKSPACE_NAME}::hash
${CMAKE_WORKSPACE_NAME}::zk

$<TARGET_NAME_IF_EXISTS:boost_math>
$<TARGET_NAME_IF_EXISTS:boost_multiprecision>
)

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


if(BUILD_TESTS)
add_subdirectory(test)
endif()
21 changes: 21 additions & 0 deletions LICENSE_1_0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Mikhail Komarov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 54537c8

Please sign in to comment.