Skip to content

Commit

Permalink
Merge pull request #5 from NilFoundation/directly-include-parallel-cr…
Browse files Browse the repository at this point in the history
…ypto3

Directly include parallel crypto3
  • Loading branch information
AndreyMlashkin authored Sep 9, 2024
2 parents da0ced4 + c4a33b1 commit 00e0a64
Show file tree
Hide file tree
Showing 357 changed files with 79,653 additions and 461 deletions.
File renamed without changes.
94 changes: 0 additions & 94 deletions crypto3/.clang-format

This file was deleted.

48 changes: 0 additions & 48 deletions evm-assigner/.clang-format

This file was deleted.

69 changes: 0 additions & 69 deletions evm-assigner/.clang-tidy

This file was deleted.

38 changes: 33 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
inherit system;
overlays = [ nix-3rdparty.overlays.${system}.default ];
};
in {
in rec {
packages = rec {
crypto3 = (pkgs.callPackage ./crypto3/crypto3.nix {
runTests = false;
Expand All @@ -35,6 +35,22 @@
runTests = true;
});

parallel-crypto3 = (pkgs.callPackage ./parallel-crypto3/parallel-crypto3.nix {
runTests = false;
enableDebug = false;
crypto3 = crypto3;
});
parallel-crypto3-tests = (pkgs.callPackage ./parallel-crypto3/parallel-crypto3.nix {
runTests = true;
enableDebug = false;
crypto3 = crypto3;
});
parallel-crypto3-debug-tests = (pkgs.callPackage ./parallel-crypto3/parallel-crypto3.nix {
enableDebug = true;
runTests = true;
crypto3 = crypto3;
});

evm-assigner = (pkgs.callPackage ./evm-assigner/evm-assigner.nix {
runTests = false;
enableDebug = false;
Expand Down Expand Up @@ -92,10 +108,22 @@
enableDebug = false;
});

parallel-crypto3-gcc = (pkgs.callPackage ./parallel-crypto3/parallel-crypto3.nix {
runTests = true;
enableDebug = false;
crypto3 = packages.crypto3;
});
parallel-crypto3-clang = (pkgs.callPackage ./parallel-crypto3/parallel-crypto3.nix {
stdenv = pkgs.llvmPackages_18.stdenv;
runTests = true;
enableDebug = false;
crypto3 = crypto3-clang;
});

evm-assigner-gcc = (pkgs.callPackage ./evm-assigner/evm-assigner.nix {
runTests = true;
enableDebug = false;
crypto3 = crypto3-gcc;
crypto3 = packages.crypto3;
});
evm-assigner-clang = (pkgs.callPackage ./evm-assigner/evm-assigner.nix {
stdenv = pkgs.llvmPackages_18.stdenv;
Expand All @@ -107,17 +135,17 @@
zkevm-framework-gcc = (pkgs.callPackage ./zkevm-framework/zkevm-framework.nix {
runTests = true;
enableDebug = false;
crypto3 = crypto3-gcc;
crypto3 = packages.crypto3;
evm-assigner = evm-assigner-gcc;
});

all-clang = pkgs.symlinkJoin {
name = "all";
paths = [ crypto3-clang evm-assigner-clang ];
paths = [ crypto3-clang parallel-crypto3-clang evm-assigner-clang ];
};
all-gcc = pkgs.symlinkJoin {
name = "all";
paths = [ crypto3-gcc evm-assigner-gcc zkevm-framework-gcc ];
paths = [ crypto3-gcc parallel-crypto3-gcc evm-assigner-gcc zkevm-framework-gcc ];
};
default = all-gcc;
};
Expand Down
13 changes: 13 additions & 0 deletions parallel-crypto3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
.cache
build
55 changes: 55 additions & 0 deletions parallel-crypto3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
project(parallel-crypto3)

find_package(CM)

if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "-ggdb -O0")
endif()

# This is useful due to some build systems (Ninja in particular) are piping
# compiler output and compiler switches it's output to plain text
option (FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE)
if (${FORCE_COLORED_OUTPUT})
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options (-fcolor-diagnostics)
endif ()
endif ()

# The file compile_commands.json is generated in build directory, so LSP could
# pick it up and guess all include paths, defines and other stuff.
# If Nix is used, LSP could not guess the locations of implicit include
# directories, so we need to include them explicitly.
if(CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
endif()

# TODO: check what is actually required here
include(CMConfig)
include(CMDeploy)
include(CMSetupVersion)

# TODO: beutify entire cmake tree of parallel crypto3 modules the same way we did in origin crypto3
find_package(Boost REQUIRED COMPONENTS filesystem log program_options thread random unit_test_framework)
find_package(crypto3 REQUIRED)

# HACK: since there are no more crypto3::submodule targets, we have to ALIAS any used
# target of such type to recently introduced crypto3::all target
# TODO: update dependencies in actor modules
add_library(crypto3::algebra ALIAS crypto3::all)
add_library(crypto3::block ALIAS crypto3::all)
add_library(crypto3::hash ALIAS crypto3::all)
add_library(crypto3::multiprecision ALIAS crypto3::all)
add_library(crypto3::random ALIAS crypto3::all)
add_library(marshalling::core ALIAS crypto3::all)
add_library(marshalling::crypto3_multiprecision ALIAS crypto3::all)
add_library(marshalling::crypto3_algebra ALIAS crypto3::all)
add_library(marshalling::crypto3_zk ALIAS crypto3::all)

add_subdirectory(libs/parallelization-utils)
add_subdirectory(libs/parallel-containers)
add_subdirectory(libs/parallel-math)
add_subdirectory(libs/parallel-zk)
21 changes: 21 additions & 0 deletions parallel-crypto3/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 =nil; Foundation

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 00e0a64

Please sign in to comment.