From 49c1e27feeb04a14ccd4c64501694e7c32f3a22f Mon Sep 17 00:00:00 2001 From: "Roland C. Dowdeswell" Date: Tue, 8 Feb 2022 23:35:51 +0000 Subject: [PATCH] utils/: remove numpy as a dependency --- utils/Dockerfile | 8 ++++---- utils/faucet-gen.py | 8 ++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/utils/Dockerfile b/utils/Dockerfile index b5c8b0890..be1c22f70 100644 --- a/utils/Dockerfile +++ b/utils/Dockerfile @@ -11,15 +11,15 @@ ENV PYTHONUNBUFFERED=1 RUN PIP="pip --no-cache install" \ APK_ADD="apk add --no-cache"; \ - $APK_ADD --virtual .build-deps gcc g++ python3-dev \ + $APK_ADD --virtual .build-deps gcc python3-dev \ libffi-dev musl-dev make \ - && $APK_ADD git libsodium-dev libsecp256k1-dev gmp-dev \ + && $APK_ADD libsodium-dev libsecp256k1-dev gmp-dev \ && $APK_ADD zeromq-dev \ && $PIP install base58 pynacl \ && $PIP install pytezos requests \ - && $PIP install pyblake2 pysodium numpy flask \ + && $PIP install pyblake2 pysodium flask \ && $PIP install -e 'git+https://github.com/vbuterin/pybitcointools.git@aeb0a2bbb8bbfe421432d776c649650eaeb882a5#egg=bitcoin' \ - && apk del .build-deps git \ + && apk del .build-deps \ && $APK_ADD jq netcat-openbsd curl binutils \ && $APK_ADD lz4 diff --git a/utils/faucet-gen.py b/utils/faucet-gen.py index c2ef2679c..e9b18af0d 100755 --- a/utils/faucet-gen.py +++ b/utils/faucet-gen.py @@ -20,7 +20,6 @@ import json import bitcoin import binascii -import numpy as np import pysodium from pyblake2 import blake2b import unicodedata @@ -71,8 +70,8 @@ def genesis_commitments(wallets, blind): def make_dummy_wallets(n, blind): # Not a realistic shape, but for an alphanet faucet it's better to # have less variance. - amounts = np.random.pareto(10.0, n) - amounts = amounts / sum(amounts) * 700e6 + amounts = [ random.paretovariate(10.0) - 1 for i in range(n) ] + amounts = [ i / sum(amounts) * 700e6 for i in amounts ] wallets = {} secrets = {} for i in range(0, n): @@ -103,9 +102,6 @@ def make_dummy_wallets(n, blind): blind = args.seed.encode('utf-8') # initialize random functions for determinism random.seed(a=blind, version=2) - numpy_seed = random.randint(0,2**32) - print("numpy seed is %s" % numpy_seed) - np.random.seed(seed=numpy_seed) wallets, secrets = make_dummy_wallets(args.number_of_accounts, blind) commitments = genesis_commitments(wallets, blind)