Skip to content

Commit

Permalink
Fix Raise Exceptions - add flake8, mypi (#108)
Browse files Browse the repository at this point in the history
* Raise should use Exception("Err msg here")

* Run (breaking) pytest python-impl/ dir

* Add flake8, mypi. TODO mypi import blspy issue

* Add ltgm buttons. Fix flake8 invocation.

* Add gh status and verbosity - why isn't sodium in the wheel?

* Unbreak build. Verbosity back to 0

* Confirm from @mariano54 that python-impl currently vestigal
  • Loading branch information
hoffmang9 authored May 9, 2020
1 parent aa6c0b8 commit fbdc9f1
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
max-line-length = 120
exclude = ./typings/**/*
ignore = E203,W503

16 changes: 14 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:

- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel==1.3.0
- name: Mac OS build C++ and test
Expand All @@ -40,6 +41,16 @@ jobs:
echo "Running ./src/runtest"
./src/runtest
- name: Lint source with flake8
run: |
pip install flake8
flake8 src/
- name: Lint source with mypy
run: |
pip install mypy
mypy --config-file mypi.ini python-impl python-bindings
- name: Build source distribution with MacOS
if: startsWith(matrix.os, 'mac')
run: |
Expand All @@ -59,7 +70,7 @@ jobs:
./src/runtest
valgrind --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./src/runtest
- name: Build wheel
- name: Build wheel and test
run: |
python -m cibuildwheel --output-dir dist
env:
Expand All @@ -68,14 +79,15 @@ jobs:
# don't build i686 targets, can't seem to find cmake for these
CIBW_SKIP: '*-manylinux_i686 *-win32'
# we need boost
CIBW_TEST_REQUIRES: pytest
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
CIBW_BEFORE_BUILD_LINUX: curl -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-`uname -m`.sh > cmake.sh && yes | sh cmake.sh | cat && rm -f /usr/bin/cmake && python -m pip install --upgrade pip && which cmake && cmake --version
CIBW_BEFORE_BUILD_MACOS: python -m pip install --upgrade pip
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.14
CIBW_BUILD_VERBOSITY_MACOS: 0
CIBW_BEFORE_BUILD_WINDOWS: python -m pip install --upgrade pip && pwd && git clone https://github.com/Chia-Network/relic_gmp_64.git && ls -l relic_gmp_64 && git clone https://github.com/Chia-Network/mpir_gc_x64.git && ls -l mpir_gc_x64
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "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_skylake.dll {wheel} && delocate-wheel -v -i mpir_gc_x64/mpir_skylake_avx.dll {wheel} && cp {wheel} {dest_dir} && ls -l {dest_dir} && pwd && ls -l dist && rm -fr relic_gmp_64 && rm -fr mpir_gc_x64"
CIBW_TEST_COMMAND: python {project}/python-bindings/test.py
CIBW_TEST_COMMAND: python {project}/python-bindings/test.py #the pure python implementation, is not used anywhere and will be replaced - pytest {project}/python-impl/tests.py
CIBW_ENVIRONMENT_LINUX: "PATH=/project/cmake-3.17.0-Linux-`uname -m`/bin:$PATH BUILD_VDF_CLIENT=N"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "pip uninstall -y delocate && pip install git+https://github.com/Chia-Network/delocate.git && delocate-listdeps {wheel} && delocate-wheel -v {wheel} && cp {wheel} {dest_dir} && ls -l {dest_dir} && pwd && ls -l dist"

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ blspy.egg-info
dist
python-impl/__pycache__/
blspy.*.so
.mypy_cache/
.pytest_chache/

js_build
node_modules
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
![Build](https://github.com/Chia-Network/bls-signatures/workflows/Build/badge.svg)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/Chia-Network/bls-signatures.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Chia-Network/bls-signatures/alerts/)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Chia-Network/bls-signatures.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Chia-Network/bls-signatures/context:javascript)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/Chia-Network/bls-signatures.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Chia-Network/bls-signatures/context:python)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/Chia-Network/bls-signatures.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Chia-Network/bls-signatures/context:cpp)

### BLS Signatures implementation

NOTE: THIS LIBRARY IS A DRAFT AND NOT YET REVIEWED FOR SECURITY

Implements BLS signatures with aggregation as in [Boneh, Drijvers, Neven 2018](https://crypto.stanford.edu/~dabo/pubs/papers/BLSmultisig.html), using
[relic toolkit](https://github.com/relic-toolkit/relic) for cryptographic primitives (pairings, EC, hashing).
The [BLS12-381](https://github.com/zkcrypto/pairing/tree/master/src/bls12_381) curve is used. The spec is [here](https://github.com/Chia-Network/bls-signatures/tree/master/SPEC.md).
This library will be migrating to the [IETF BLS RFC](https://datatracker.ietf.org/doc/draft-irtf-cfrg-bls-signature/) shortly.

Features:
* Non-interactive signature aggregation on identical or distinct messages
Expand Down
2 changes: 2 additions & 0 deletions mypi.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mypy]
ignore_missing_imports = True

0 comments on commit fbdc9f1

Please sign in to comment.