Skip to content

Commit

Permalink
Merge ccf8f7e into 8b06cf5
Browse files Browse the repository at this point in the history
  • Loading branch information
wjblanke committed Jun 7, 2023
2 parents 8b06cf5 + ccf8f7e commit a779945
Show file tree
Hide file tree
Showing 22 changed files with 1,356 additions and 1,351 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,8 @@ jobs:
CIBW_BEFORE_ALL_WINDOWS: >
curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-msvc.zip > libsodium-1.0.18-stable-msvc.zip
&& 7z x libsodium-1.0.18-stable-msvc.zip
&& git clone https://github.com/Chia-Network/relic_ietf_64.git
&& ls -l relic_ietf_64
&& git clone https://github.com/Chia-Network/mpir_gc_x64.git
&& ls -l mpir_gc_x64
&& git clone https://github.com/supranational/blst.git
&& ls -l blst
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
ls -l mpir_gc_x64 && pip uninstall -y delocate
&& pip install git+https://github.com/Chia-Network/delocate.git
Expand Down
78 changes: 0 additions & 78 deletions .github/workflows/relic-nightly.yml

This file was deleted.

102 changes: 8 additions & 94 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(NOT CMAKE_BUILD_TYPE)
)
endif()

project(BLS)
project(BLS C CXX ASM)

set(BUILD_BLS_PYTHON_BINDINGS "1" CACHE STRING "")
set(BUILD_BLS_TESTS "1" CACHE STRING "")
Expand Down Expand Up @@ -42,104 +42,18 @@ set(SODIUM_DISABLE_TESTS "on" CACHE STRING "")
set(SODIUM_CHIA_MINIMAL "on" CACHE STRING "")
FetchContent_MakeAvailable(Sodium)

if(DEFINED ENV{RELIC_MAIN})
set(RELIC_GIT_TAG "origin/main")
set(RELIC_REPOSITORY "https://github.com/relic-toolkit/relic.git")
else()
# This is currently anchored to upstream aecdcae7956f542fbee2392c1f0feb0a8ac41dc5
set(RELIC_GIT_TAG "215c69966cb78b255995f0ee9c86bbbb41c3c42b")
set(RELIC_REPOSITORY "https://github.com/Chia-Network/relic.git")
endif()
set(BLST_GIT_TAG "origin/master")
set(BLST_REPOSITORY "https://github.com/supranational/blst")

message(STATUS "Relic will be built from: ${RELIC_GIT_TAG} and repository ${RELIC_REPOSITORY}")
message(STATUS "blst will be built from: ${BLST_GIT_TAG} and repository ${BLST_REPOSITORY}")

FetchContent_Declare(
relic
GIT_REPOSITORY ${RELIC_REPOSITORY}
GIT_TAG ${RELIC_GIT_TAG}
blst
GIT_REPOSITORY ${BLST_REPOSITORY}
GIT_TAG ${BLST_GIT_TAG}
)

# Relic related options

set(STBIN "off" CACHE STRING "Relic - Build static binaries")

find_package(gmp)
if (GMP_FOUND)
message(STATUS "Found libgmp")
set(ARITH "gmp" CACHE STRING "")
else()
set(ARITH "easy" CACHE STRING "")
endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(WSIZE "32" CACHE STRING "Relic - Processor word size")
else()
set(WSIZE "64" CACHE STRING "Relic - Processor word size")
endif()

if(EMSCRIPTEN)
# emscripten needs arch set to be none since it can't compile assembly
set(ARCH "" CACHE STRING "")
# emscripten is a 32 bit compiler
set(WSIZE "32" CACHE STRING "Relic - Processor word size")
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(TIMER "ANSI" CACHE STRING "")
set(MULTI "OPENMP" CACHE STRING "")
else()
set(TIMER "CYCLE" CACHE STRING "")
set(MULTI "PTHREAD" CACHE STRING "")
endif()

set(CHECK "off" CACHE STRING "")
set(VERBS "off" CACHE STRING "")
set(ALLOC "AUTO" CACHE STRING "")
set(SHLIB "off" CACHE STRING "")
set(DOCUM "off" CACHE STRING "")
set(FP_PRIME "381" CACHE STRING "Relic - Prime modulus size")

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SEED "UDEV" CACHE STRING "")
set(FP_QNRES "off" CACHE STRING "")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(SEED "WCGR" CACHE STRING "")
set(FP_QNRES "on" CACHE STRING "")
else()
set(SEED "UDEV" CACHE STRING "")
set(FP_QNRES "on" CACHE STRING "")
endif()

if(DEFINED ENV{RELIC_MAIN})
set(FP_METHD "INTEG;INTEG;INTEG;MONTY;LOWER;JMPDS;SLIDE" CACHE STRING "")
if(MSVC)
set(CFLAGS "" CACHE STRING "")
else()
set(CFLAGS "-O3 -funroll-loops -fomit-frame-pointer" CACHE STRING "")
endif()
else()
set(FP_METHD "INTEG;INTEG;INTEG;MONTY;LOWER;SLIDE" CACHE STRING "")
if(MSVC)
set(COMP_FLAGS "" CACHE STRING "")
else()
set(COMP_FLAGS "-O3 -funroll-loops -fomit-frame-pointer" CACHE STRING "")
endif()
endif()

set(FP_PMERS "off" CACHE STRING "")
set(FPX_METHD "INTEG;INTEG;LAZYR" CACHE STRING "")
set(EP_PLAIN "off" CACHE STRING "")
set(EP_SUPER "off" CACHE STRING "")
# Disable relic tests and benchmarks
set(TESTS "0" CACHE STRING "Relic - Number of times each test is ran")
set(BENCH "0" CACHE STRING "Relic - Number of times each benchmark is ran")

set(QUIET "on" CACHE STRING "Relic - Build with printing disabled")

set(PP_EXT "LAZYR" CACHE STRING "")
set(PP_METHD "LAZYR;OATEP" CACHE STRING "")

FetchContent_MakeAvailable(relic)
FetchContent_MakeAvailable(blst)

add_subdirectory(src)

Expand Down
87 changes: 0 additions & 87 deletions cmake_modules/Findgmp.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion python-bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FetchContent_Declare(
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.10.0
)
FetchContent_MakeAvailable(pybind11 relic)
FetchContent_MakeAvailable(pybind11 blst)

pybind11_add_module(blspy ${CMAKE_CURRENT_SOURCE_DIR}/pythonbindings.cpp)
target_link_libraries(blspy PRIVATE bls)
29 changes: 0 additions & 29 deletions python-bindings/pythonbindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,20 +442,6 @@ PYBIND11_MODULE(blspy, m)
return self + other;
},
py::is_operator())
.def(
"__mul__",
[](G1Element &self, bn_t other) {
py::gil_scoped_release release;
return self * (*(bn_t *)&other);
},
py::is_operator())
.def(
"__rmul__",
[](G1Element &self, bn_t other) {
py::gil_scoped_release release;
return self * (*(bn_t *)&other);
},
py::is_operator())
.def(
"__and__",
[](G1Element &self, G2Element &other) {
Expand Down Expand Up @@ -588,21 +574,6 @@ PYBIND11_MODULE(blspy, m)
return self + other;
},
py::is_operator())
.def(
"__mul__",
[](G2Element &self, bn_t other) {
py::gil_scoped_release release;
return self * (*(bn_t *)&other);
},
py::is_operator())
.def(
"__rmul__",
[](G2Element &self, bn_t other) {
py::gil_scoped_release release;
return self * (*(bn_t *)&other);
},
py::is_operator())

.def(
"__repr__",
[](const G2Element &ele) {
Expand Down
Loading

0 comments on commit a779945

Please sign in to comment.