From 693cae40ec956b6916bace1d8af99f3490224ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Andronache?= Date: Tue, 5 Mar 2019 23:14:24 +0000 Subject: [PATCH 01/14] update version() --- README.rst | 5 +++-- docs/rpc/methods/node.rst | 5 +++-- src/nano/rpc.py | 12 +++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index 397ae41..dff3a98 100644 --- a/README.rst +++ b/README.rst @@ -63,8 +63,9 @@ for examples of usage. >>> rpc.version() { 'rpc_version': 1, - 'store_version': 10, - 'node_vendor': 'RaiBlocks 9.0' + 'store_version': 13, + 'protocol_version': 16, + 'node_vendor': 'Nano 18.0' } >>> rpc.peers() { diff --git a/docs/rpc/methods/node.rst b/docs/rpc/methods/node.rst index 00793b2..2ca563b 100644 --- a/docs/rpc/methods/node.rst +++ b/docs/rpc/methods/node.rst @@ -308,6 +308,7 @@ Returns the node's RPC version >>> rpc.version() { "rpc_version": 1, - "store_version": 10, - "node_vendor": "RaiBlocks 9.0" + "store_version": 13, + "protocol_version": 16, + "node_vendor": "Nano 18.0" } diff --git a/src/nano/rpc.py b/src/nano/rpc.py index bdd2ed3..af37604 100644 --- a/src/nano/rpc.py +++ b/src/nano/rpc.py @@ -30,8 +30,9 @@ class Client(object): >>> rpc.version() { 'rpc_version': 1, - 'store_version': 10, - 'node_vendor': 'RaiBlocks 9.0' + 'store_version': 13, + 'protocol_version': 16, + 'node_vendor': 'Nano 18.0' } """ @@ -3356,15 +3357,16 @@ def version(self): >>> rpc.version() { "rpc_version": 1, - "store_version": 10, - "node_vendor": "RaiBlocks 9.0" + "store_version": 13, + "protocol_version": 16, + "node_vendor": "Nano 18.0" } """ resp = self.call('version') - for key in ('rpc_version', 'store_version'): + for key in ('rpc_version', 'store_version', 'protocol_version'): resp[key] = int(resp[key]) return resp From a1a41cfd9e6393855fab2123ce8c68158a1d4f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Andronache?= Date: Tue, 5 Mar 2019 23:37:27 +0000 Subject: [PATCH 02/14] update tests for new version() --- tests/fixtures/rpc/version.json | 10 ++++++---- tests/test_mock_rpc.py | 5 +++-- tests/test_rpc.py | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/fixtures/rpc/version.json b/tests/fixtures/rpc/version.json index a4dbd27..e8ce442 100644 --- a/tests/fixtures/rpc/version.json +++ b/tests/fixtures/rpc/version.json @@ -1,17 +1,19 @@ [ { "expected": { - "node_vendor": "RaiBlocks 9.0", + "node_vendor": "Nano 18.0", + "protocol_version": 16, "rpc_version": 1, - "store_version": 10 + "store_version": 13 }, "request": { "action": "version" }, "response": { - "node_vendor": "RaiBlocks 9.0", + "node_vendor": "Nano 18.0", + "protocol_version": "16", "rpc_version": "1", - "store_version": "10" + "store_version": "13" } } ] diff --git a/tests/test_mock_rpc.py b/tests/test_mock_rpc.py index 2689f81..60b2708 100644 --- a/tests/test_mock_rpc.py +++ b/tests/test_mock_rpc.py @@ -10,8 +10,9 @@ def test_existing_request(self, mock_rpc_session): ) assert resp.json() == { "rpc_version": "1", - "store_version": "10", - "node_vendor": "RaiBlocks 9.0", + "store_version": "13", + "protocol_version": "16", + "node_vendor": "Nano 18.0", } def test_missing_request(self, mock_rpc_session): diff --git a/tests/test_rpc.py b/tests/test_rpc.py index e389f3c..3135c88 100644 --- a/tests/test_rpc.py +++ b/tests/test_rpc.py @@ -24,8 +24,9 @@ def test_create(self, arguments): def test_call_valid_action(self, rpc): assert rpc.call('version') == { "rpc_version": "1", - "store_version": "10", - "node_vendor": "RaiBlocks 9.0", + "store_version": "13", + "protocol_version": "16", + "node_vendor": "Nano 18.0", } def test_call_invalid_action(self, rpc): From 7f45bd6bbe492875633d1b5bad14bf73689e5781 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Wed, 13 Mar 2019 00:24:25 -0400 Subject: [PATCH 03/14] Update certifi from 2017.11.5 to 2019.3.9 --- requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.pip b/requirements.pip index c54d50a..f392b76 100644 --- a/requirements.pip +++ b/requirements.pip @@ -1,4 +1,4 @@ -certifi==2017.11.5 +certifi==2019.3.9 chardet==3.0.4 idna==2.6 pyblake2==1.1.0 From 5625ab757643b30528c8b63b9739b0c4a62c7046 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Wed, 13 Mar 2019 00:24:28 -0400 Subject: [PATCH 04/14] Update idna from 2.6 to 2.8 --- requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.pip b/requirements.pip index c54d50a..825e687 100644 --- a/requirements.pip +++ b/requirements.pip @@ -1,6 +1,6 @@ certifi==2017.11.5 chardet==3.0.4 -idna==2.6 +idna==2.8 pyblake2==1.1.0 requests==2.18.4 six==1.11.0 From 0cbcafaee144c5e2519bef9ac1602859ee767e00 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Wed, 13 Mar 2019 00:24:30 -0400 Subject: [PATCH 05/14] Update pyblake2 from 1.1.0 to 1.1.2 --- requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.pip b/requirements.pip index c54d50a..3c6dcdf 100644 --- a/requirements.pip +++ b/requirements.pip @@ -1,7 +1,7 @@ certifi==2017.11.5 chardet==3.0.4 idna==2.6 -pyblake2==1.1.0 +pyblake2==1.1.2 requests==2.18.4 six==1.11.0 urllib3==1.22 From d05cf26b8a71fecf171043c50a36f321bf67c40a Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Wed, 13 Mar 2019 00:24:33 -0400 Subject: [PATCH 06/14] Update requests from 2.18.4 to 2.21.0 --- requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.pip b/requirements.pip index c54d50a..2a22693 100644 --- a/requirements.pip +++ b/requirements.pip @@ -2,6 +2,6 @@ certifi==2017.11.5 chardet==3.0.4 idna==2.6 pyblake2==1.1.0 -requests==2.18.4 +requests==2.21.0 six==1.11.0 urllib3==1.22 From 2b07a0b394c242f7ff93dd83396d1c6b8b622aea Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Wed, 13 Mar 2019 00:24:36 -0400 Subject: [PATCH 07/14] Update six from 1.11.0 to 1.12.0 --- requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.pip b/requirements.pip index c54d50a..f76e27f 100644 --- a/requirements.pip +++ b/requirements.pip @@ -3,5 +3,5 @@ chardet==3.0.4 idna==2.6 pyblake2==1.1.0 requests==2.18.4 -six==1.11.0 +six==1.12.0 urllib3==1.22 From 91d7fcd4c1de0575e41d078336d891ba266665a5 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Wed, 13 Mar 2019 00:24:39 -0400 Subject: [PATCH 08/14] Update urllib3 from 1.22 to 1.24.1 --- requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.pip b/requirements.pip index c54d50a..0bf5e99 100644 --- a/requirements.pip +++ b/requirements.pip @@ -4,4 +4,4 @@ idna==2.6 pyblake2==1.1.0 requests==2.18.4 six==1.11.0 -urllib3==1.22 +urllib3==1.24.1 From a9e02934220ba3cc11f6e637d54ee791bd7202f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Andronache?= Date: Wed, 13 Mar 2019 12:58:20 +0000 Subject: [PATCH 09/14] pyup.io config file --- .pyup.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .pyup.yml diff --git a/.pyup.yml b/.pyup.yml new file mode 100644 index 0000000..c06bdc9 --- /dev/null +++ b/.pyup.yml @@ -0,0 +1,21 @@ +# update schedule +# default: empty +# allowed: "every day", "every week", .. +schedule: "every day" + +# search for requirement files +# default: True +# allowed: True, False +search: False + +# Specify requirement files by hand, default is empty +# default: empty +# allowed: list +requirements: + - requirements.pip: + # update all dependencies and pin them + update: all + pin: True + - requirements-dev.pip: + # don't update dependencies, use global 'pin' default + update: False From 53dddd59f1306369acdf18d09aca18f943d06f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Andronache?= Date: Wed, 13 Mar 2019 13:11:12 +0000 Subject: [PATCH 10/14] fix error in "code-block" directive --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index dff3a98..c47cf5a 100644 --- a/README.rst +++ b/README.rst @@ -77,6 +77,7 @@ Crypto/Accounts =============== .. code-block:: python + >>> from nano import generate_account, verify_signature, sign_message >>> account = generate_account(seed='someseed') >>> signature = sign_message(b'this', account['private_key_bytes']) From 2d851dd632e696a26f7e74e5f78573c9b6a7c058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Andronache?= Date: Wed, 13 Mar 2019 13:12:22 +0000 Subject: [PATCH 11/14] add make for Windows --- docs/make.bat | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 docs/make.bat diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..7893348 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd From 8a964c095e8ca46215585e93c957b8ac64837f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Andronache?= Date: Wed, 13 Mar 2019 13:15:41 +0000 Subject: [PATCH 12/14] fix links that were permanent redirects --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index c47cf5a..f745c15 100644 --- a/README.rst +++ b/README.rst @@ -9,17 +9,17 @@ Nano (RaiBlocks) Python Library :target: https://travis-ci.org/dourvaris/nano-python .. image:: https://readthedocs.org/projects/nano-python/badge/?version=latest - :target: http://nano-python.readthedocs.io/en/latest/?badge=latest + :target: https://nano-python.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status .. image:: https://github.com/dourvaris/nano-python/raw/master/coverage.svg?sanitize=true :target: https://travis-ci.org/dourvaris/nano-python .. image:: https://img.shields.io/pypi/pyversions/nano-python.svg?style=flat-square - :target: https://pypi.python.org/pypi/nano-python + :target: https://pypi.org/project/nano-python/ .. image:: https://img.shields.io/pypi/v/nano-python.svg - :target: https://pypi.python.org/pypi/nano-python + :target: https://pypi.org/project/nano-python/ This library contains a python wrapper for the Nano (RaiBlocks) RPC server which tries to make it a little easier to work with by converting RPC responses From fa2bcb77689e824207aeeeea40afca318c5d37ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Andronache?= Date: Wed, 13 Mar 2019 21:52:05 +0000 Subject: [PATCH 13/14] Kenneth Reitz recommends not to pin certifi, source: https://snyk.io/blog/python-security-best-practices-cheat-sheet/ --- requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.pip b/requirements.pip index 5e26a27..0fe49e4 100644 --- a/requirements.pip +++ b/requirements.pip @@ -1,4 +1,4 @@ -certifi==2019.3.9 +certifi chardet==3.0.4 idna==2.8 pyblake2==1.1.2 From 538e93962cbaf9d0caeb82319b4a9d515380f1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Andronache?= Date: Fri, 15 Mar 2019 15:50:28 +0000 Subject: [PATCH 14/14] use `secrets` instead of `random`, in order to access the most secure source of randomness provided by the OS --- src/nano/accounts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nano/accounts.py b/src/nano/accounts.py index 1f6c62e..c8f539b 100644 --- a/src/nano/accounts.py +++ b/src/nano/accounts.py @@ -13,7 +13,7 @@ """ -import random +import secrets from binascii import hexlify, unhexlify from .crypto import b32xrb_encode, b32xrb_decode, address_checksum, keypair_from_seed @@ -129,7 +129,7 @@ def generate_account(seed=None, index=0): """ if not seed: - seed = unhexlify(''.join(random.choice('0123456789ABCDEF') for i in range(64))) + seed = unhexlify(''.join(secrets.choice('0123456789ABCDEF') for i in range(64))) pair = keypair_from_seed(seed, index=index) result = {