Skip to content

Commit

Permalink
Merge branch 'main' into snyk-upgrade-f4a07d14e5fc1e67482b8ea72b16c71f
Browse files Browse the repository at this point in the history
  • Loading branch information
wallentx committed Jun 15, 2023
2 parents 7993ca7 + 0b1745f commit 4e6b00f
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 217 deletions.
30 changes: 5 additions & 25 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,31 @@ jobs:
- major-dot-minor: '3.7'
cibw-build: 'cp37-*'
manylinux:
arch: manylinux2014
arm: manylinux2014
intel: manylinux2010
matrix: '3.7'
- major-dot-minor: '3.8'
cibw-build: 'cp38-*'
manylinux:
arch: manylinux2014
arm: manylinux2014
intel: manylinux2010
matrix: '3.8'
- major-dot-minor: '3.9'
cibw-build: 'cp39-*'
manylinux:
arch: manylinux2014
arm: manylinux2014
intel: manylinux2010
matrix: '3.9'
- major-dot-minor: '3.10'
cibw-build: 'cp310-*'
manylinux:
arch: manylinux2014
arm: manylinux2014
intel: manylinux2010
matrix: '3.10'
- major-dot-minor: '3.11'
cibw-build: 'cp311-*'
manylinux:
arch: manylinux2014
arm: manylinux2014
intel: manylinux2014
matrix: '3.11'
arch:
Expand Down Expand Up @@ -154,26 +154,6 @@ jobs:
CIBW_BEFORE_BUILD_MACOS: >
python -m pip install --upgrade pip
CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=10.14"
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
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
ls -l mpir_gc_x64 && pip uninstall -y delocate
&& pip install git+https://github.com/Chia-Network/delocate.git
&& delocate-wheel -v -i mpir_gc_x64/mpir.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_gc.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_broadwell.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_broadwell_avx.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_bulldozer.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_haswell.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_piledriver.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_sandybridge.dll {wheel}
&& delocate-wheel -v -i mpir_gc_x64/mpir_skylake_avx.dll {wheel}
&& cp {wheel} {dest_dir}
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: py.test -v {project}/python-bindings/test.py
run:
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "35 9 * * 1"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ javascript, python, cpp ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: After Prepare (cpp)
if: ${{ matrix.language == 'cpp' }}
run: |
mkdir custom_cmake
wget --quiet -O - "https://cmake.org/files/v3.16/cmake-3.16.3-Linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C custom_cmake
export PATH=$(pwd)/custom_cmake/bin:${PATH} && echo "PATH=$PATH" >> $GITHUB_ENV
cd $GITHUB_WORKSPACE/
export CMAKE_INCLUDE_PATH=$GITHUB_WORKSPACE/include:${CMAKE_INCLUDE_PATH} && echo "CMAKE_INCLUDE_PATH=$CMAKE_INCLUDE_PATH" >> $GITHUB_ENV
export CMAKE_LIBRARY_PATH=$GITHUB_WORKSPACE/lib:${CMAKE_LIBRARY_PATH} && echo "CMAKE_LIBRARY_PATH=$CMAKE_LIBRARY_PATH" >> $GITHUB_ENV
mkdir $GITHUB_WORKSPACE/_lgtm_build_dir
cd $GITHUB_WORKSPACE/_lgtm_build_dir
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
34 changes: 29 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if(DEFINED ENV{RELIC_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_GIT_TAG "2a4ed8ded3a9a5ac5e39f3877f357264b2e16f11")
set(RELIC_REPOSITORY "https://github.com/Chia-Network/relic.git")
endif()

Expand All @@ -63,12 +63,25 @@ FetchContent_Declare(

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

find_package(gmp)
if (GMP_FOUND)
message(STATUS "Found libgmp")
if(MSVC)
set(ARITH "gmp" CACHE STRING "")
# We'll be using our custom MPIR build instead of GMP for MSVC builds
FetchContent_Declare(
chia_mpir
GIT_REPOSITORY https://github.com/Chia-Network/mpir_gc_x64.git
GIT_SHALLOW true
)
FetchContent_MakeAvailable(chia_mpir)
set(MPIR_INCLUDE_DIR ${chia_mpir_SOURCE_DIR} CACHE STRING "")
set(MPIR_IMPLIB "${chia_mpir_SOURCE_DIR}/mpir.lib" CACHE STRING "")
else()
set(ARITH "easy" CACHE STRING "")
find_package(gmp)
if(GMP_FOUND)
message(STATUS "Found libgmp")
set(ARITH "gmp" CACHE STRING "")
else()
set(ARITH "easy" CACHE STRING "")
endif()
endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 4)
Expand Down Expand Up @@ -141,6 +154,17 @@ set(PP_METHD "LAZYR;OATEP" CACHE STRING "")

FetchContent_MakeAvailable(relic)

function(handle_mpir_dlls _target)
file(GLOB chia_mpir_dlls ${chia_mpir_SOURCE_DIR}/*.dll)
foreach(mpir_dll IN LISTS chia_mpir_dlls)
add_custom_command(
TARGET ${_target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${mpir_dll} $<TARGET_FILE_DIR:${_target}>
)
endforeach()
endfunction()

add_subdirectory(src)

if(EMSCRIPTEN)
Expand Down
2 changes: 1 addition & 1 deletion emsdk_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ rm -rf js_build
mkdir -p js_build
cd js_build

emcmake cmake -G "Unix Makefiles" ..
emcmake cmake -G "Unix Makefiles" -DBUILD_BLS_TESTS=0 -DBUILD_BLS_BENCHMARKS=0 ..
emmake make
48 changes: 32 additions & 16 deletions js-bindings/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions js-bindings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@
],
"devDependencies": {
"@types/mocha": "^5.2.7",
"@types/node": "^11.15.18",
"@types/node": "^20.1.5",
"assert": "^2.0.0",
"babel-polyfill": "^6.26.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"karma": "^6.4.2",
"karma-firefox-launcher": "^1.3.0",
"karma-firefox-launcher": "^2.1.2",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-webpack": "^5.0.0",
"mime": "1.4.1",
"mime": "3.0.0",
"mocha": "^10.2.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"stream-browserify": "^3.0.0",
"typescript": "^3.6.5",
"typescript": "^5.0.4",
"webpack": "^5.39.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion js_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ git submodule update --init --recursive
mkdir js_build
cd js_build

cmake ../ -DCMAKE_TOOLCHAIN_FILE=$(dirname $(realpath $(which emcc)))/cmake/Modules/Platform/Emscripten.cmake
cmake ../ -DBUILD_BLS_TESTS=0 -DBUILD_BLS_BENCHMARKS=0 -DCMAKE_TOOLCHAIN_FILE=$(dirname $(realpath $(which emcc)))/cmake/Modules/Platform/Emscripten.cmake
cmake --build . --
3 changes: 2 additions & 1 deletion python-bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ FetchContent_Declare(
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.10.0
)
FetchContent_MakeAvailable(pybind11 relic)
FetchContent_MakeAvailable(pybind11)

pybind11_add_module(blspy ${CMAKE_CURRENT_SOURCE_DIR}/pythonbindings.cpp)
target_link_libraries(blspy PRIVATE bls)
handle_mpir_dlls(blspy)
Loading

0 comments on commit 4e6b00f

Please sign in to comment.