diff --git a/autobahn/_version.py b/autobahn/_version.py index 821b15b10..df0380770 100644 --- a/autobahn/_version.py +++ b/autobahn/_version.py @@ -24,4 +24,4 @@ # ############################################################################### -__version__ = '20.12.1' +__version__ = '20.12.2' diff --git a/autobahn/xbr/_mnemonic.py b/autobahn/xbr/_mnemonic.py index 3881a0d85..997a2c170 100755 --- a/autobahn/xbr/_mnemonic.py +++ b/autobahn/xbr/_mnemonic.py @@ -63,9 +63,9 @@ def derive_public_key(private_key): Logic adapted from https://github.com/satoshilabs/slips/blob/master/slip-0010/testvectors.py. """ Q = int.from_bytes(private_key, byteorder='big') * BIP32_CURVE.generator - xstr = Q.x().to_bytes(32, byteorder='big') + xstr = int(Q.x()).to_bytes(32, byteorder='big') parity = Q.y() & 1 - return (2 + parity).to_bytes(1, byteorder='big') + xstr + return int(2 + parity).to_bytes(1, byteorder='big') + xstr def derive_bip32childkey(parent_key, parent_chain_code, i): @@ -87,7 +87,7 @@ def derive_bip32childkey(parent_key, parent_chain_code, i): b = int.from_bytes(parent_key, byteorder='big') key = (a + b) % BIP32_CURVE.order if a < BIP32_CURVE.order and key != 0: - key = key.to_bytes(32, byteorder='big') + key = int(key).to_bytes(32, byteorder='big') break d = b'\x01' + h[32:] + struct.pack('>L', i) @@ -103,7 +103,7 @@ def fingerprint(public_key): def b58xprv(parent_fingerprint, private_key, chain, depth, childnr): """ Private key b58 serialization format. """ - raw = (b'\x04\x88\xad\xe4' + bytes(chr(depth), 'utf-8') + parent_fingerprint + childnr.to_bytes( + raw = (b'\x04\x88\xad\xe4' + bytes(chr(depth), 'utf-8') + parent_fingerprint + int(childnr).to_bytes( 4, byteorder='big') + chain + b'\x00' + private_key) return b58encode_check(raw) @@ -112,7 +112,7 @@ def b58xprv(parent_fingerprint, private_key, chain, depth, childnr): def b58xpub(parent_fingerprint, public_key, chain, depth, childnr): """ Public key b58 serialization format. """ - raw = (b'\x04\x88\xb2\x1e' + bytes(chr(depth), 'utf-8') + parent_fingerprint + childnr.to_bytes( + raw = (b'\x04\x88\xb2\x1e' + bytes(chr(depth), 'utf-8') + parent_fingerprint + int(childnr).to_bytes( 4, byteorder='big') + chain + public_key) return b58encode_check(raw) diff --git a/autobahn/xbr/test/test_mnemonic.py b/autobahn/xbr/test/test_mnemonic.py index a66f364b1..d5ebca52f 100644 --- a/autobahn/xbr/test/test_mnemonic.py +++ b/autobahn/xbr/test/test_mnemonic.py @@ -32,6 +32,7 @@ from autobahn.xbr import generate_seedphrase, check_seedphrase, account_from_seedphrase _SEEDPHRASE = "myth like bonus scare over problem client lizard pioneer submit female collect" + _INVALID_SEEDPHRASE = "9 nn \0 kk$" _EXPECTED = [ ('0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1', '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d'), @@ -58,15 +59,19 @@ class TestEthereumMnemonic(unittest.TestCase): - def test_check_seedphrase(self): + def test_check_valid_seedphrase(self): self.assertTrue(check_seedphrase(_SEEDPHRASE)) + def test_check_invalid_seedphrase(self): + self.assertFalse(check_seedphrase(_INVALID_SEEDPHRASE)) + def test_generate_seedphrase(self): for strength in [128, 160, 192, 224, 256]: seedphrase = generate_seedphrase(strength) self.assertEqual(type(seedphrase), str) - self.assertTrue(type(word) == bool for word in seedphrase.split()) + for word in seedphrase.split(): + self.assertTrue(type(word) == str) self.assertTrue(check_seedphrase(seedphrase)) def test_derive_wallet(self): diff --git a/docker/aarch64/Dockerfile.cpy3 b/docker/aarch64/Dockerfile.cpy3 index 3eb3c1fdf..56456714d 100644 --- a/docker/aarch64/Dockerfile.cpy3 +++ b/docker/aarch64/Dockerfile.cpy3 @@ -1,4 +1,4 @@ -FROM arm64v8/python:3.7-slim-stretch +FROM arm64v8/python:3.9-slim COPY .qemu/qemu-aarch64-static /usr/bin/qemu-aarch64-static diff --git a/docker/aarch64/Dockerfile.pypy3 b/docker/aarch64/Dockerfile.pypy3 index 21fd905a5..15d247585 100644 --- a/docker/aarch64/Dockerfile.pypy3 +++ b/docker/aarch64/Dockerfile.pypy3 @@ -1,4 +1,4 @@ -FROM arm64v8/pypy:3.6-slim-stretch +FROM arm64v8/pypy:3.7-slim COPY .qemu/qemu-aarch64-static /usr/bin/qemu-aarch64-static diff --git a/docker/armhf/Dockerfile.cpy3 b/docker/armhf/Dockerfile.cpy3 index b79143c28..a03515f9c 100644 --- a/docker/armhf/Dockerfile.cpy3 +++ b/docker/armhf/Dockerfile.cpy3 @@ -1,4 +1,4 @@ -FROM arm32v7/python:3.7-slim-stretch +FROM arm32v7/python:3.9-slim COPY .qemu/qemu-arm-static /usr/bin/qemu-arm-static diff --git a/docker/armhf/Dockerfile.pypy3 b/docker/armhf/Dockerfile.pypy3 index 84e2e4719..35d706b0c 100644 --- a/docker/armhf/Dockerfile.pypy3 +++ b/docker/armhf/Dockerfile.pypy3 @@ -1,4 +1,6 @@ -FROM arm32v7/pypy:3.6-slim-stretch +FROM arm32v7/pypy:3.6-slim +# FROM arm32v7/pypy:3.7-7.3.3-slim +# arm32v7/pypy:3.7-slim COPY .qemu/qemu-arm-static /usr/bin/qemu-arm-static diff --git a/docker/x86_64/Dockerfile.cpy3 b/docker/x86_64/Dockerfile.cpy3 index 714185821..5ee41f3b9 100644 --- a/docker/x86_64/Dockerfile.cpy3 +++ b/docker/x86_64/Dockerfile.cpy3 @@ -1,4 +1,4 @@ -FROM amd64/python:3.7-slim-stretch +FROM amd64/python:3.9-slim MAINTAINER The Crossbar.io Project diff --git a/docker/x86_64/Dockerfile.cpy3-alpine b/docker/x86_64/Dockerfile.cpy3-alpine index bf819ee6b..3bdf66b81 100644 --- a/docker/x86_64/Dockerfile.cpy3-alpine +++ b/docker/x86_64/Dockerfile.cpy3-alpine @@ -1,4 +1,4 @@ -FROM python:3.7-alpine +FROM python:3.9-alpine MAINTAINER The Crossbar.io Project diff --git a/docker/x86_64/Dockerfile.cpy3-minimal-aio b/docker/x86_64/Dockerfile.cpy3-minimal-aio index a363def44..d8023ef87 100644 --- a/docker/x86_64/Dockerfile.cpy3-minimal-aio +++ b/docker/x86_64/Dockerfile.cpy3-minimal-aio @@ -1,4 +1,4 @@ -FROM python:3.7-alpine +FROM python:3.9-alpine MAINTAINER The Crossbar.io Project diff --git a/docker/x86_64/Dockerfile.cpy3-minimal-tx b/docker/x86_64/Dockerfile.cpy3-minimal-tx index 99d4c0f16..df4d70956 100644 --- a/docker/x86_64/Dockerfile.cpy3-minimal-tx +++ b/docker/x86_64/Dockerfile.cpy3-minimal-tx @@ -1,4 +1,4 @@ -FROM python:3.7-alpine +FROM python:3.9-alpine MAINTAINER The Crossbar.io Project diff --git a/docker/x86_64/Dockerfile.pypy3 b/docker/x86_64/Dockerfile.pypy3 index 2ffb12f5f..9eab02906 100644 --- a/docker/x86_64/Dockerfile.pypy3 +++ b/docker/x86_64/Dockerfile.pypy3 @@ -1,4 +1,5 @@ -FROM amd64/pypy:3.6-slim-stretch +FROM amd64/pypy:3.7-7.3.3-slim-buster +# FROM amd64/pypy:3.6-slim-stretch MAINTAINER The Crossbar.io Project diff --git a/docker/x86_64/Makefile b/docker/x86_64/Makefile index ae45ce74e..8793f455c 100644 --- a/docker/x86_64/Makefile +++ b/docker/x86_64/Makefile @@ -17,51 +17,51 @@ build: -t crossbario/autobahn-python:pypy3-${AUTOBAHN_PYTHON_VERSION} \ -f Dockerfile.pypy3 . - time docker build \ - --build-arg BUILD_DATE=${BUILD_DATE} \ - --build-arg AUTOBAHN_PYTHON_VCS_REF=${AUTOBAHN_PYTHON_VCS_REF} \ - --build-arg AUTOBAHN_PYTHON_VERSION=${AUTOBAHN_PYTHON_VERSION} \ - -t crossbario/autobahn-python:latest \ - -t crossbario/autobahn-python:cpy3-alpine \ - -t crossbario/autobahn-python:cpy3-alpine-${AUTOBAHN_PYTHON_VERSION} \ - -f Dockerfile.cpy3-alpine . - - time docker build \ - --build-arg BUILD_DATE=${BUILD_DATE} \ - --build-arg AUTOBAHN_PYTHON_VCS_REF=${AUTOBAHN_PYTHON_VCS_REF} \ - --build-arg AUTOBAHN_PYTHON_VERSION=${AUTOBAHN_PYTHON_VERSION} \ - -t crossbario/autobahn-python:cpy3-minimal-aio \ - -t crossbario/autobahn-python:cpy3-minimal-aio-${AUTOBAHN_PYTHON_VERSION} \ - -f Dockerfile.cpy3-minimal-aio . - - time docker build \ - --build-arg BUILD_DATE=${BUILD_DATE} \ - --build-arg AUTOBAHN_PYTHON_VCS_REF=${AUTOBAHN_PYTHON_VCS_REF} \ - --build-arg AUTOBAHN_PYTHON_VERSION=${AUTOBAHN_PYTHON_VERSION} \ - -t crossbario/autobahn-python:cpy3-minimal-tx \ - -t crossbario/autobahn-python:cpy3-minimal-tx-${AUTOBAHN_PYTHON_VERSION} \ - -f Dockerfile.cpy3-minimal-tx . + # time docker build \ + # --build-arg BUILD_DATE=${BUILD_DATE} \ + # --build-arg AUTOBAHN_PYTHON_VCS_REF=${AUTOBAHN_PYTHON_VCS_REF} \ + # --build-arg AUTOBAHN_PYTHON_VERSION=${AUTOBAHN_PYTHON_VERSION} \ + # -t crossbario/autobahn-python:latest \ + # -t crossbario/autobahn-python:cpy3-alpine \ + # -t crossbario/autobahn-python:cpy3-alpine-${AUTOBAHN_PYTHON_VERSION} \ + # -f Dockerfile.cpy3-alpine . + + # time docker build \ + # --build-arg BUILD_DATE=${BUILD_DATE} \ + # --build-arg AUTOBAHN_PYTHON_VCS_REF=${AUTOBAHN_PYTHON_VCS_REF} \ + # --build-arg AUTOBAHN_PYTHON_VERSION=${AUTOBAHN_PYTHON_VERSION} \ + # -t crossbario/autobahn-python:cpy3-minimal-aio \ + # -t crossbario/autobahn-python:cpy3-minimal-aio-${AUTOBAHN_PYTHON_VERSION} \ + # -f Dockerfile.cpy3-minimal-aio . + + # time docker build \ + # --build-arg BUILD_DATE=${BUILD_DATE} \ + # --build-arg AUTOBAHN_PYTHON_VCS_REF=${AUTOBAHN_PYTHON_VCS_REF} \ + # --build-arg AUTOBAHN_PYTHON_VERSION=${AUTOBAHN_PYTHON_VERSION} \ + # -t crossbario/autobahn-python:cpy3-minimal-tx \ + # -t crossbario/autobahn-python:cpy3-minimal-tx-${AUTOBAHN_PYTHON_VERSION} \ + # -f Dockerfile.cpy3-minimal-tx . version: python_version autobahn_version xbr_version python_version: docker run -it --rm crossbario/autobahn-python:cpy3 python -V docker run -it --rm crossbario/autobahn-python:pypy3 python -V - docker run -it --rm crossbario/autobahn-python:cpy3-alpine python -V - docker run -it --rm crossbario/autobahn-python:cpy3-minimal-aio python -V - docker run -it --rm crossbario/autobahn-python:cpy3-minimal-tx python -V + # docker run -it --rm crossbario/autobahn-python:cpy3-alpine python -V + # docker run -it --rm crossbario/autobahn-python:cpy3-minimal-aio python -V + # docker run -it --rm crossbario/autobahn-python:cpy3-minimal-tx python -V autobahn_version: docker run -it --rm crossbario/autobahn-python:cpy3 python -c "import autobahn; print('running autobahn-{}'.format(autobahn.__version__))" docker run -it --rm crossbario/autobahn-python:pypy3 python -c "import autobahn; print('running autobahn-{}'.format(autobahn.__version__))" - docker run -it --rm crossbario/autobahn-python:cpy3-alpine python -c "import autobahn; print('running autobahn-{}'.format(autobahn.__version__))" - docker run -it --rm crossbario/autobahn-python:cpy3-minimal-aio python -c "import autobahn; print('running autobahn-{}'.format(autobahn.__version__))" - docker run -it --rm crossbario/autobahn-python:cpy3-minimal-tx python -c "import autobahn; print('running autobahn-{}'.format(autobahn.__version__))" + # docker run -it --rm crossbario/autobahn-python:cpy3-alpine python -c "import autobahn; print('running autobahn-{}'.format(autobahn.__version__))" + # docker run -it --rm crossbario/autobahn-python:cpy3-minimal-aio python -c "import autobahn; print('running autobahn-{}'.format(autobahn.__version__))" + # docker run -it --rm crossbario/autobahn-python:cpy3-minimal-tx python -c "import autobahn; print('running autobahn-{}'.format(autobahn.__version__))" xbr_version: docker run -it --rm crossbario/autobahn-python:cpy3 python -c "from autobahn import xbr; print(xbr.network.address)" docker run -it --rm crossbario/autobahn-python:pypy3 python -c "from autobahn import xbr; print(xbr.network.address)" - docker run -it --rm crossbario/autobahn-python:cpy3-alpine python -c "from autobahn import xbr; print(xbr.network.address)" + # docker run -it --rm crossbario/autobahn-python:cpy3-alpine python -c "from autobahn import xbr; print(xbr.network.address)" test: test_cpy3 test_pypy3 test_cpy3_alpine test_cpy3_minimal_aio test_cpy3_minimal_tx @@ -88,12 +88,12 @@ publish: docker push crossbario/autobahn-python:cpy3-${AUTOBAHN_PYTHON_VERSION} docker push crossbario/autobahn-python:pypy3 docker push crossbario/autobahn-python:pypy3-${AUTOBAHN_PYTHON_VERSION} - docker push crossbario/autobahn-python:cpy3-alpine - docker push crossbario/autobahn-python:cpy3-alpine-${AUTOBAHN_PYTHON_VERSION} - docker push crossbario/autobahn-python:cpy3-minimal-aio - docker push crossbario/autobahn-python:cpy3-minimal-aio-${AUTOBAHN_PYTHON_VERSION} - docker push crossbario/autobahn-python:cpy3-minimal-tx - docker push crossbario/autobahn-python:cpy3-minimal-tx-${AUTOBAHN_PYTHON_VERSION} + # docker push crossbario/autobahn-python:cpy3-alpine + # docker push crossbario/autobahn-python:cpy3-alpine-${AUTOBAHN_PYTHON_VERSION} + # docker push crossbario/autobahn-python:cpy3-minimal-aio + # docker push crossbario/autobahn-python:cpy3-minimal-aio-${AUTOBAHN_PYTHON_VERSION} + # docker push crossbario/autobahn-python:cpy3-minimal-tx + # docker push crossbario/autobahn-python:cpy3-minimal-tx-${AUTOBAHN_PYTHON_VERSION} list: -docker images crossbario/autobahn-python:* diff --git a/docs/changelog.rst b/docs/changelog.rst index d0f172990..141855155 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,12 @@ Changelog ========= +20.12.2 +------- + +* fix: derive_bip32childkey traceback (#1436) +* fix: update and adjust docker files to upstream changes + 20.12.1 -------