From c87e896acbe6aace114d20926fe51ea4d4bd05fb Mon Sep 17 00:00:00 2001 From: Mariano Sorgente Date: Thu, 27 Jun 2019 18:07:08 +0900 Subject: [PATCH] Attempt to fix travis build (#66) --- .travis.yml | 2 ++ python-bindings/README.md | 6 ++++++ python-impl/fields.py | 17 ++++------------- python-impl/tests.py | 14 +++++++------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f692efffcde59..0d28baee6fbdf2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ sudo: enabled language: cpp +os: linux +dist: trusty before_install: - sudo add-apt-repository -y ppa:deadsnakes/ppa - sudo apt-get update diff --git a/python-bindings/README.md b/python-bindings/README.md index bfade2fa79fe2e..dca9fdf146d67c 100644 --- a/python-bindings/README.md +++ b/python-bindings/README.md @@ -175,3 +175,9 @@ prepend_agg = PrependSignature.aggregate([prepend1, prepend2]) ok = prepend_agg.verify([Util.hash256(msg), Util.hash256(msg)], [pk1, pk2]) ``` + +#### Publishing the library +```bash +python3 setup.py sdist bdist_wheel +twine upload dist/* +``` diff --git a/python-impl/fields.py b/python-impl/fields.py index 76cbefeac06173..b14acfdb140033 100644 --- a/python-impl/fields.py +++ b/python-impl/fields.py @@ -71,19 +71,10 @@ def __pow__(self, other): return Fq(self.Q, 1) elif other == 1: return self - - el = self - multiply = [] - while other > 1: - if other % 2 == 1: - multiply.append(el) - el = el * el - other = other // 2 - - for m in multiply: - el *= m - - return el + elif other % 2 == 0: + return (self * self) ** (other // 2) + else: + return (self * self) ** (other // 2) * self def qi_power(self, i): return self diff --git a/python-impl/tests.py b/python-impl/tests.py index bfa60b7953ba3f..41f12cd6d2dd04 100644 --- a/python-impl/tests.py +++ b/python-impl/tests.py @@ -13,7 +13,7 @@ from threshold import Threshold from util import hash256 -# setrecursionlimit(10**6) +setrecursionlimit(10**6) def rand_scalar(ec=default_ec): @@ -445,13 +445,13 @@ def test_threshold(): test_threshold_instance(T, 5) -# test_threshold() +test_threshold() test_fields() -# test_ec() -# test_vectors() -# test_vectors2() -# test_vectors3() -# test_vectors4() +test_ec() +test_vectors() +test_vectors2() +test_vectors3() +test_vectors4() test1() test2()