[Python-modules-commits] [python-trezor] 01/05: Import python-trezor_0.7.6.orig.tar.gz
Tristan Seligmann
mithrandi at moszumanska.debian.org
Sun Nov 20 21:04:31 UTC 2016
This is an automated email from the git hooks/post-receive script.
mithrandi pushed a commit to branch master
in repository python-trezor.
commit c811b3bb99367201d1792fd5e1d35e4fe293120f
Author: Tristan Seligmann <mithrandi at mithrandi.net>
Date: Sun Nov 20 22:18:21 2016 +0200
Import python-trezor_0.7.6.orig.tar.gz
---
PKG-INFO | 2 +-
README.rst | 42 ++--
setup.py | 18 +-
tests/common.py | 4 +
tests/config.py | 2 -
tests/test_ecies.py | 134 -------------
tests/test_msg_applysettings.py | 2 +-
tests/test_msg_cipherkeyvalue.py | 60 +++---
tests/test_msg_ethereum_getaddress.py | 17 ++
tests/test_msg_ethereum_signtx.py | 139 +++++++++++++
tests/test_msg_getaddress_show.py | 4 +-
tests/test_msg_getentropy.py | 2 +-
tests/test_msg_loaddevice.py | 7 +
tests/test_msg_resetdevice.py | 16 +-
tests/test_msg_signidentity.py | 16 +-
tests/test_msg_signmessage.py | 12 +-
tests/test_msg_signtx.py | 141 +++++++------
tests/test_msg_signtx_zcash.py | 55 ++++++
tests/test_msg_simplesigntx.py | 360 ----------------------------------
tests/test_msg_verifymessage.py | 22 ++-
tests/test_multisig.py | 16 +-
tests/test_multisig_change.py | 42 ++--
tests/test_op_return.py | 6 +-
tests/test_protect_call.py | 2 +-
tests/test_protection_levels.py | 2 +-
tests/test_zerosig.py | 13 +-
trezor.egg-info/PKG-INFO | 2 +-
trezor.egg-info/SOURCES.txt | 9 +-
trezor.egg-info/requires.txt | 1 +
trezorctl | 163 ++++++++-------
trezorlib/ckd_public.py | 16 +-
trezorlib/client.py | 308 +++++++++++++++--------------
trezorlib/debuglink.py | 10 +
trezorlib/messages_pb2.py | 277 +++++++++++++-------------
trezorlib/tools.py | 37 ++--
trezorlib/transport.py | 259 ++++++++++++++++++------
trezorlib/transport_bridge.py | 18 +-
trezorlib/transport_fake.py | 24 ---
trezorlib/transport_hid.py | 184 +++++++++--------
trezorlib/transport_pipe.py | 38 ++--
trezorlib/transport_serial.py | 41 ----
trezorlib/transport_socket.py | 112 -----------
trezorlib/transport_udp.py | 51 +++++
trezorlib/tx_api.py | 30 ++-
trezorlib/types_pb2.py | 117 ++++++++---
45 files changed, 1391 insertions(+), 1442 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index 67954e6..8868774 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trezor
-Version: 0.6.13
+Version: 0.7.6
Summary: Python library for communicating with TREZOR Bitcoin Hardware Wallet
Home-page: https://github.com/trezor/python-trezor
Author: Bitcoin TREZOR
diff --git a/README.rst b/README.rst
index 73a0358..9ec4a01 100644
--- a/README.rst
+++ b/README.rst
@@ -11,10 +11,25 @@ Client side implementation for TREZOR-compatible Bitcoin hardware wallets.
See http://bitcointrezor.com for more information.
+Install
+-------
+
+(Run with sudo if not running in superuser mode under Linux)
+
+.. code::
+
+ pip install trezor
+
+On Linux you might need to run these commands first:
+
+.. code::
+ sudo apt-get install python-dev cython libusb-1.0-0-dev libudev-dev git
+ sudo pip install setuptools
+
Example
-------
-also found in ``helloworld.py``
+also found in ``tools/helloworld.py``
.. code:: python
@@ -72,28 +87,3 @@ Example: your PIN is **1234** and TREZOR is displaying the following:
=== === ===
You have to enter: **3795**
-
-Install
--------
-
-(Run with sudo if not running in superuser mode)
-
-.. code::
-
- pip install trezor
-
-How to install from source (Windows)
-------------------------------------
-* Install Python 2.7 (http://python.org)
-* Install Cython (Windows binaries on http://cython.org/#download)
-* Install Microsoft Visual Studio 2008 Express
-* Add "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0" to system PATH
-* Clone repository (using TortoiseGit) to local directory
-* Run C:\\python27\\python.exe setup.py install (or develop)
-
-How to install from source (Debian/Ubuntu)
-------------------------------------------
-* sudo apt-get install python-dev python-setuptools cython libusb-1.0-0-dev libudev-dev git
-* git clone https://github.com/trezor/python-trezor.git
-* cd python-trezor
-* python setup.py install (or develop)
diff --git a/setup.py b/setup.py
index 09a87e5..ebe56ff 100755
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,17 @@
#!/usr/bin/env python
from setuptools import setup
+install_requires = ['ecdsa>=0.9', 'protobuf>=2.6.1', 'mnemonic>=0.8', 'setuptools>=19.0']
+
+import sys
+if '--disable-hidapi' in sys.argv:
+ sys.argv.remove('--disable-hidapi')
+else:
+ install_requires.append('hidapi>=0.7.99')
+
setup(
name='trezor',
- version='0.6.13',
+ version='0.7.6',
author='Bitcoin TREZOR',
author_email='info at bitcointrezor.com',
description='Python library for communicating with TREZOR Bitcoin Hardware Wallet',
@@ -18,18 +26,16 @@ setup(
'trezorlib.qt.pinmatrix',
'trezorlib.tools',
'trezorlib.transport',
- 'trezorlib.transport_fake',
- 'trezorlib.transport_hid',
'trezorlib.transport_bridge',
+ 'trezorlib.transport_hid',
'trezorlib.transport_pipe',
- 'trezorlib.transport_serial',
- 'trezorlib.transport_socket',
+ 'trezorlib.transport_udp',
'trezorlib.tx_api',
'trezorlib.types_pb2',
],
scripts = ['trezorctl'],
test_suite='tests',
- install_requires=['ecdsa>=0.9', 'protobuf>=2.6.1', 'mnemonic>=0.8', 'hidapi>=0.7.99'],
+ install_requires=install_requires,
include_package_data=True,
zip_safe=False,
classifiers=[
diff --git a/tests/common.py b/tests/common.py
index 3a8bd90..16dac14 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -18,6 +18,7 @@ class TrezorTest(unittest.TestCase):
self.mnemonic12 = 'alcohol woman abuse must during monitor noble actual mixed trade anger aisle'
self.mnemonic18 = 'owner little vague addict embark decide pink prosper true fork panda embody mixture exchange choose canoe electric jewel'
self.mnemonic24 = 'dignity pass list indicate nasty swamp pool script soccer toe leaf photo multiply desk host tomato cradle drill spread actor shine dismiss champion exotic'
+ self.mnemonic_all = ' '.join(['all'] * 12)
self.pin4 = '1234'
self.pin6 = '789456'
@@ -28,6 +29,9 @@ class TrezorTest(unittest.TestCase):
print("Setup finished")
print("--------------")
+ def setup_mnemonic_allallall(self):
+ self.client.load_device_by_mnemonic(mnemonic=self.mnemonic_all, pin='', passphrase_protection=False, label='test', language='english')
+
def setup_mnemonic_nopin_nopassphrase(self):
self.client.load_device_by_mnemonic(mnemonic=self.mnemonic12, pin='', passphrase_protection=False, label='test', language='english')
diff --git a/tests/config.py b/tests/config.py
index 7b882e4..35df62f 100644
--- a/tests/config.py
+++ b/tests/config.py
@@ -5,8 +5,6 @@ sys.path = ['../',] + sys.path
from trezorlib.transport_pipe import PipeTransport
from trezorlib.transport_hid import HidTransport
-from trezorlib.transport_socket import SocketTransportClient
-#from trezorlib.transport_bridge import BridgeTransport
devices = HidTransport.enumerate()
diff --git a/tests/test_ecies.py b/tests/test_ecies.py
deleted file mode 100644
index b04b693..0000000
--- a/tests/test_ecies.py
+++ /dev/null
@@ -1,134 +0,0 @@
-from __future__ import print_function
-
-import unittest
-import common
-import binascii
-import base64
-
-from trezorlib.client import CallException
-
-# as described here: http://memwallet.info/btcmssgs.html
-
-def test_ecies_backforth(cls, test_string):
- cls.setup_mnemonic_nopin_nopassphrase()
-
- pubkey = binascii.unhexlify('0338d78612e990f2eea0c426b5e48a8db70b9d7ed66282b3b26511e0b1c75515a6')
-
- # encrypt without signature
- enc = cls.client.encrypt_message(pubkey, test_string, display_only=False, coin_name='Bitcoin', n=[])
- print('base64:', base64.b64encode(enc.nonce + enc.message + enc.hmac))
- dec = cls.client.decrypt_message([1], enc.nonce, enc.message, enc.hmac)
- cls.assertEqual(dec.message, test_string)
- cls.assertEqual(dec.address, '')
-
- # encrypt with signature
- enc = cls.client.encrypt_message(pubkey, test_string, display_only=False, coin_name='Bitcoin', n=[5])
- print('base64:', base64.b64encode(enc.nonce + enc.message + enc.hmac))
- dec = cls.client.decrypt_message([1], enc.nonce, enc.message, enc.hmac)
- cls.assertEqual(dec.message, test_string)
- cls.assertEqual(dec.address, '1Csf6LVPkv24FBs6bpj4ELPszE6mGf6jeV')
-
- # encrypt without signature, show only on display
- enc = cls.client.encrypt_message(pubkey, test_string, display_only=True, coin_name='Bitcoin', n=[])
- dec = cls.client.decrypt_message([1], enc.nonce, enc.message, enc.hmac)
- cls.assertEqual(dec.message, '')
- cls.assertEqual(dec.address, '')
-
- # encrypt with signature, show only on display
- enc = cls.client.encrypt_message(pubkey, test_string, display_only=True, coin_name='Bitcoin', n=[5])
- dec = cls.client.decrypt_message([1], enc.nonce, enc.message, enc.hmac)
- cls.assertEqual(dec.message, '')
- cls.assertEqual(dec.address, '')
-
-class TestEcies(common.TrezorTest):
-
-# index: m/1
-# address: 1CK7SJdcb8z9HuvVft3D91HLpLC6KSsGb
-# pubkey: 0338d78612e990f2eea0c426b5e48a8db70b9d7ed66282b3b26511e0b1c75515a6
-# privkey: L5X3rf5hJfRt9ZjQzFopvSBGkpnSotn4jKGLL6ECJxcuT2JgGh65
-
-# index: m/5
-# address: 1Csf6LVPkv24FBs6bpj4ELPszE6mGf6jeV
-# pubkey: 0234716c01c2dd03fa7ee302705e2b8fbd1311895d94b1dca15e62eedea9b0968f
-# privkey: L4uKPRgaZqL9iGmge3UBSLGTQC7gDFrLRhC1vM4LmGyrzNUBb1Zs
-
- def test_ecies_backforth_short(self):
- test_ecies_backforth(self, 'testing message!')
-
- def test_ecies_backforth_long(self):
- test_ecies_backforth(self, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin elementum libero in tortor condimentum malesuada. Quisque gravida semper sapien, ut ultrices dolor pharetra nec. Nulla hendrerit metus imperdiet, feugiat sapien eu, fermentum mauris. Suspendisse nec bibendum urna. Vivamus augue libero, mollis vel augue at, venenatis vestibulum nunc. Curabitur condimentum quam non nibh volutpat, at congue libero rutrum. Morbi at sollicitudin lectus. Donec co [...]
-
- def test_ecies_crosscheck(self):
- self.setup_mnemonic_nopin_nopassphrase()
-
- # decrypt message without signature
- payload = 'AhA1yCZStrmtuGSgliJ7K02eD8xWRoyRU1ryPu9kBloODFv9hATpqukL0YSzISfrQGygYVai5OirxU0='
- payload = base64.b64decode(payload)
- nonce, msg, hmac = payload[:33], payload[33:-8], payload[-8:]
- dec = self.client.decrypt_message([1], nonce, msg, hmac)
- self.assertEqual(dec.message, 'testing message!')
- self.assertEqual(dec.address, '')
-
- # decrypt message without signature (same message, different nonce)
- payload = 'A9ragu6UTXisBWw6bTCcM/SeR7fmlQp6Qzg9mpJ5qKBv9BIgWX/v/u+OhdlKLZTx6C0Xooz5aIvWrqw='
- payload = base64.b64decode(payload)
- nonce, msg, hmac = payload[:33], payload[33:-8], payload[-8:]
- dec = self.client.decrypt_message([1], nonce, msg, hmac)
- self.assertEqual(dec.message, 'testing message!')
- self.assertEqual(dec.address, '')
-
- # decrypt message with signature
- payload = 'A90Awe+vrQvmzFvm0hh8Ver7jcBbqiCxV4RGU9knKf6F3vvG1N45Q3kc+N1sd4inzXZnW/5KH74CXaCPGAKr/a0n4BUhADVfS2Ic9Luwcs6/cuYHSzJKKLSPUYC6N4hu1K0q1vR/02BJ+iZ0pfvChoGDmpOOO7NaIEoyiKAnZFNsHr6Ffplg3YVGJAAG7GgfSQ=='
- payload = base64.b64decode(payload)
- nonce, msg, hmac = payload[:33], payload[33:-8], payload[-8:]
- dec = self.client.decrypt_message([1], nonce, msg, hmac)
- self.assertEqual(dec.message, 'testing message!')
- self.assertEqual(dec.address, '1Csf6LVPkv24FBs6bpj4ELPszE6mGf6jeV')
-
- # decrypt message with signature (same message, different nonce)
- payload = 'AyeglkkBSc3VLNrXETiNtiS+t2nIKeEVGMVfF7KlVM+plBuX3yc+2kf+Yo6L1NKoqEjSlRXn71OTOEWfB2zmtasIX9dQBfyGluEivbeUfqbwneepEzv9/i0XI3ywfSa2HSdic8B68nZ3D6Mms4qOpzk6AEPt/yI7fl8aUsN0lxT8nVBfMmmg10oydvH/86cWYA=='
- payload = base64.b64decode(payload)
- nonce, msg, hmac = payload[:33], payload[33:-8], payload[-8:]
- dec = self.client.decrypt_message([1], nonce, msg, hmac)
- self.assertEqual(dec.message, 'testing message!')
- self.assertEqual(dec.address, '1Csf6LVPkv24FBs6bpj4ELPszE6mGf6jeV')
-
- def test_ecies_crosscheck_long(self):
- self.setup_mnemonic_nopin_nopassphrase()
-
- lipsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin elementum libero in tortor condimentum malesuada. Quisque gravida semper sapien, ut ultrices dolor pharetra nec. Nulla hendrerit metus imperdiet, feugiat sapien eu, fermentum mauris. Suspendisse nec bibendum urna. Vivamus augue libero, mollis vel augue at, venenatis vestibulum nunc. Curabitur condimentum quam non nibh volutpat, at congue libero rutrum. Morbi at sollicitudin lectus. Donec commodo rutrum solli [...]
-
- # decrypt message without signature
- payload = 'AhnOXSv+7mI3Tvw0ekCxvEoMvophrWOGAwLT2IpyxaCd+zgftijj2uQoGtSktFwch8oABstTqwBjokH4AllH7PaL/8dWwOELwEVIXlbktf8nktUITBkJ0Abih8Imq451Bwrt8ZMt0tzoDBWeRLtZGHPduHnykGjq1O3A8Qjd4k8W+PkPBum+rNKlPOUqoNpSvOcPD9L6APkMByPKMmTq5K9nSeLKyXjOtWcx4BLRqRe9qgvG+SWFHsJ/90O76XZIB6GXDqGnCNR5rV/8Ho4bfagRL/tQPbeQ4iYWAyqdRlKuwnUrrZSJCdrsQJt1Ye5LcltE0YhJBKRmxob2/P+ziyceZk6cU3hS9k4B1GKlEeGxipvMswfbrEIy/5NYiGXEDwC3dHwM3g1Opz5oXbEKZ3NG/eEh5UxJFjfyx1qumQeSaIo5XFOf81A4dhH1vAT8MMEQN7bXXwCb1fxDC9wblCP9i [...]
- payload = base64.b64decode(payload)
- nonce, msg, hmac = payload[:33], payload[33:-8], payload[-8:]
- dec = self.client.decrypt_message([1], nonce, msg, hmac)
- self.assertEqual(dec.message, lipsum)
- self.assertEqual(dec.address, '')
-
- # decrypt message without signature (same message, different nonce)
- payload = 'A2bVIKzpPVYJlPP6WMiwhpabJfJAHH927StDsUyRL2h3xc/aMPVN6rYA9GwcsPSDiZpPZdjCVYM4uDwFQ/kBNA1p5XlDs6IBGtGGgbR7P5wHgJaxcw1zWZ+TsWTIWVj3psy0CFg7zCfqeV2y0OzIvJc/p+ONdVb1f9TmTICPoVGJ9AVXdnfdqdIn+wLYScUklTp10ldfUCmt5iAsJJR1p+h+xa+wwUdyCxpvnxOZDxA0EFmxQskBhcDbLL2nmQkLm5RnLQgpefMCEJrdz5g9htC5y65eod2SFBV8oJrN1ryh4PdRn5+JyVcwWhQeCHTK3m6vOIwwht5lm2uCLpcEttDoxo5k3LcBPE4rlPVYCf8qja6sRKq/WYiLdwXnooX/qmmLQ7Lo2DBs4hB6VQGgPSSTH/3/rUb11bL2Ieyq73ZICeIbHCIvjFqhd/atkNvQTnCrNmFybyxdMqE/4Yrv7b//h [...]
- payload = base64.b64decode(payload)
- nonce, msg, hmac = payload[:33], payload[33:-8], payload[-8:]
- dec = self.client.decrypt_message([1], nonce, msg, hmac)
- self.assertEqual(dec.message, lipsum)
- self.assertEqual(dec.address, '')
-
- # decrypt message with signature
- payload = 'ArJoHqnmLY22QiCePXk9yNQSK6g8BMGLkKkj72p35hCW1gxVajIZyptgbBp4A0LV8Fshe6MKnHO5PGw2BPQ6yTES5Q+7c8ZjC4m8JCKOOU8l7et4AcftPElxBdKimEv5B5egQmzSYds6dfB73VsWi2k9J/1RpckB2WDvXSrF1915XA4tMTMefB/DhzdrG9gkVTBqaROTgxlXWJhqdFag4aghVcXS5Ru6CQH0cLoxmZWf8mx/pK4liXyH1Gm+7fl8cd9iDkNTJEapzn/Ohh7JYxJrV/i4p0xE9L5CONL+UIL8DtGB8SgAWtd5cHdpLhMywRFxjDvho20nE3VyGREhqiv9i3ywXRox/zd6OFBkxSA3kuWNRrkDRBx4Q+2j49V5iQquuu5horUuRRYN1HVvoOYjVkfEJV70yvVg3xR2MeJouUa1aP7WF9JPo8vor252/ZU6L15mveE0JZH1HtoierC1Q [...]
- payload = base64.b64decode(payload)
- nonce, msg, hmac = payload[:33], payload[33:-8], payload[-8:]
- dec = self.client.decrypt_message([1], nonce, msg, hmac)
- self.assertEqual(dec.message, lipsum)
- self.assertEqual(dec.address, '1Csf6LVPkv24FBs6bpj4ELPszE6mGf6jeV')
-
- # decrypt message with signature (same message, different nonce)
- payload = 'AjFarEh66x2DZ9S3T/n8/xnYZQRwnuugxCDfIIEDPKkdfgwYPjGhtg3k/9ryj42MDgmey71ZvDhUdj+igcBKaPiKAS7p88kQxl6R6sFkL/wKwTdXPboA/n63BnHrtNNDIp12Dlgn2m0nSCLOchlh2maIBqB68qIqy21tT10ZrMpTfPd+4MI4NOzs42BQJAOLy19rMTKoCXGWIsgEERG0qCm38onYVUmj5UvtQIdDLIZ/ta4WD+FqM3Y9pJsU648qV72l/xM27BjIxVqUsw6MHLrAUNTmmd+D7dPAIjL66Gr5hEHCTcHP8oCIkeC+MK2JVcHN12F1Rx+8iwNf4nsixUcZJ/RX9JOTxJj3CdxuTH3b0lDNdFwQQddYhHd6cv4t1cZ3wOWAVh1g+gmB/igmvJD200EfhQudHp/w+9BIFFfxFwAmf4/tlidJ0knIaPjNx5kBSkklhxWdBfen5kgkGFtcQ [...]
- payload = base64.b64decode(payload)
- nonce, msg, hmac = payload[:33], payload[33:-8], payload[-8:]
- dec = self.client.decrypt_message([1], nonce, msg, hmac)
- self.assertEqual(dec.message, lipsum)
- self.assertEqual(dec.address, '1Csf6LVPkv24FBs6bpj4ELPszE6mGf6jeV')
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/tests/test_msg_applysettings.py b/tests/test_msg_applysettings.py
index 0ef5da2..5b85f54 100644
--- a/tests/test_msg_applysettings.py
+++ b/tests/test_msg_applysettings.py
@@ -65,7 +65,7 @@ class TestMsgApplysettings(common.TrezorTest):
def test_apply_homescreen(self):
self.setup_mnemonic_pin_passphrase()
- img = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x04\x80\x00\x00\x00\x00\x00\x00\x00\x00\x04\x88\x02\x00\x00\x00\x02\x91\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x90@\x00\x11@\x00\x00\x00\x00\x00\x00\x08\x00\x10\x92\x12\x04\x00\x00\x05\x12D\x00\x00\x00\x00\x00 \x00\x00\x08\x00Q\x00\x00\x02\xc0\x00\x00\x00\x00\x00\x00\x00\x10\x02 \x01\x04J\x00)$\x00\x00\x00\x00\x80\x00\x00\x00\x00\x08\x10\xa1\x00\x00\x02\x8 [...]
+ img = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x04\x80\x00\x00\x00\x00\x00\x00\x00\x00\x04\x88\x02\x00\x00\x00\x02\x91\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x90@\x00\x11@\x00\x00\x00\x00\x00\x00\x08\x00\x10\x92\x12\x04\x00\x00\x05\x12D\x00\x00\x00\x00\x00 \x00\x00\x08\x00Q\x00\x00\x02\xc0\x00\x00\x00\x00\x00\x00\x00\x10\x02 \x01\x04J\x00)$\x00\x00\x00\x00\x80\x00\x00\x00\x00\x08\x10\xa1\x00\x00\x02\x [...]
with self.client:
self.client.set_expected_responses([proto.ButtonRequest(),
diff --git a/tests/test_msg_cipherkeyvalue.py b/tests/test_msg_cipherkeyvalue.py
index 1af6e19..d985321 100644
--- a/tests/test_msg_cipherkeyvalue.py
+++ b/tests/test_msg_cipherkeyvalue.py
@@ -10,65 +10,65 @@ class TestMsgCipherkeyvalue(common.TrezorTest):
self.setup_mnemonic_nopin_nopassphrase()
# different ask values
- res = self.client.encrypt_keyvalue([0, 1, 2], "test", "testing message!", ask_on_encrypt=True, ask_on_decrypt=True)
- self.assertEqual(binascii.hexlify(res), '676faf8f13272af601776bc31bc14e8f')
+ res = self.client.encrypt_keyvalue([0, 1, 2], b"test", b"testing message!", ask_on_encrypt=True, ask_on_decrypt=True)
+ self.assertEqual(binascii.hexlify(res), b'676faf8f13272af601776bc31bc14e8f')
- res = self.client.encrypt_keyvalue([0, 1, 2], "test", "testing message!", ask_on_encrypt=True, ask_on_decrypt=False)
- self.assertEqual(binascii.hexlify(res), '5aa0fbcb9d7fa669880745479d80c622')
+ res = self.client.encrypt_keyvalue([0, 1, 2], b"test", b"testing message!", ask_on_encrypt=True, ask_on_decrypt=False)
+ self.assertEqual(binascii.hexlify(res), b'5aa0fbcb9d7fa669880745479d80c622')
- res = self.client.encrypt_keyvalue([0, 1, 2], "test", "testing message!", ask_on_encrypt=False, ask_on_decrypt=True)
- self.assertEqual(binascii.hexlify(res), '958d4f63269b61044aaedc900c8d6208')
+ res = self.client.encrypt_keyvalue([0, 1, 2], b"test", b"testing message!", ask_on_encrypt=False, ask_on_decrypt=True)
+ self.assertEqual(binascii.hexlify(res), b'958d4f63269b61044aaedc900c8d6208')
- res = self.client.encrypt_keyvalue([0, 1, 2], "test", "testing message!", ask_on_encrypt=False, ask_on_decrypt=False)
- self.assertEqual(binascii.hexlify(res), 'e0cf0eb0425947000eb546cc3994bc6c')
+ res = self.client.encrypt_keyvalue([0, 1, 2], b"test", b"testing message!", ask_on_encrypt=False, ask_on_decrypt=False)
+ self.assertEqual(binascii.hexlify(res), b'e0cf0eb0425947000eb546cc3994bc6c')
# different key
- res = self.client.encrypt_keyvalue([0, 1, 2], "test2", "testing message!", ask_on_encrypt=True, ask_on_decrypt=True)
- self.assertEqual(binascii.hexlify(res), 'de247a6aa6be77a134bb3f3f925f13af')
+ res = self.client.encrypt_keyvalue([0, 1, 2], b"test2", b"testing message!", ask_on_encrypt=True, ask_on_decrypt=True)
+ self.assertEqual(binascii.hexlify(res), b'de247a6aa6be77a134bb3f3f925f13af')
# different message
- res = self.client.encrypt_keyvalue([0, 1, 2], "test", "testing message! it is different", ask_on_encrypt=True, ask_on_decrypt=True)
- self.assertEqual(binascii.hexlify(res), '676faf8f13272af601776bc31bc14e8f3ae1c88536bf18f1b44f1e4c2c4a613d')
+ res = self.client.encrypt_keyvalue([0, 1, 2], b"test", b"testing message! it is different", ask_on_encrypt=True, ask_on_decrypt=True)
+ self.assertEqual(binascii.hexlify(res), b'676faf8f13272af601776bc31bc14e8f3ae1c88536bf18f1b44f1e4c2c4a613d')
# different path
- res = self.client.encrypt_keyvalue([0, 1, 3], "test", "testing message!", ask_on_encrypt=True, ask_on_decrypt=True)
- self.assertEqual(binascii.hexlify(res), 'b4811a9d492f5355a5186ddbfccaae7b')
+ res = self.client.encrypt_keyvalue([0, 1, 3], b"test", b"testing message!", ask_on_encrypt=True, ask_on_decrypt=True)
+ self.assertEqual(binascii.hexlify(res), b'b4811a9d492f5355a5186ddbfccaae7b')
def test_decrypt(self):
self.setup_mnemonic_nopin_nopassphrase()
# different ask values
- res = self.client.decrypt_keyvalue([0, 1, 2], "test", binascii.unhexlify("676faf8f13272af601776bc31bc14e8f"), ask_on_encrypt=True, ask_on_decrypt=True)
- self.assertEqual(res, 'testing message!')
+ res = self.client.decrypt_keyvalue([0, 1, 2], b"test", binascii.unhexlify("676faf8f13272af601776bc31bc14e8f"), ask_on_encrypt=True, ask_on_decrypt=True)
+ self.assertEqual(res, b'testing message!')
- res = self.client.decrypt_keyvalue([0, 1, 2], "test", binascii.unhexlify("5aa0fbcb9d7fa669880745479d80c622"), ask_on_encrypt=True, ask_on_decrypt=False)
- self.assertEqual(res, 'testing message!')
+ res = self.client.decrypt_keyvalue([0, 1, 2], b"test", binascii.unhexlify("5aa0fbcb9d7fa669880745479d80c622"), ask_on_encrypt=True, ask_on_decrypt=False)
+ self.assertEqual(res, b'testing message!')
- res = self.client.decrypt_keyvalue([0, 1, 2], "test", binascii.unhexlify("958d4f63269b61044aaedc900c8d6208"), ask_on_encrypt=False, ask_on_decrypt=True)
- self.assertEqual(res, 'testing message!')
+ res = self.client.decrypt_keyvalue([0, 1, 2], b"test", binascii.unhexlify("958d4f63269b61044aaedc900c8d6208"), ask_on_encrypt=False, ask_on_decrypt=True)
+ self.assertEqual(res, b'testing message!')
- res = self.client.decrypt_keyvalue([0, 1, 2], "test", binascii.unhexlify("e0cf0eb0425947000eb546cc3994bc6c"), ask_on_encrypt=False, ask_on_decrypt=False)
- self.assertEqual(res, 'testing message!')
+ res = self.client.decrypt_keyvalue([0, 1, 2], b"test", binascii.unhexlify("e0cf0eb0425947000eb546cc3994bc6c"), ask_on_encrypt=False, ask_on_decrypt=False)
+ self.assertEqual(res, b'testing message!')
# different key
- res = self.client.decrypt_keyvalue([0, 1, 2], "test2", binascii.unhexlify("de247a6aa6be77a134bb3f3f925f13af"), ask_on_encrypt=True, ask_on_decrypt=True)
- self.assertEqual(res, 'testing message!')
+ res = self.client.decrypt_keyvalue([0, 1, 2], b"test2", binascii.unhexlify("de247a6aa6be77a134bb3f3f925f13af"), ask_on_encrypt=True, ask_on_decrypt=True)
+ self.assertEqual(res, b'testing message!')
# different message
- res = self.client.decrypt_keyvalue([0, 1, 2], "test", binascii.unhexlify("676faf8f13272af601776bc31bc14e8f3ae1c88536bf18f1b44f1e4c2c4a613d"), ask_on_encrypt=True, ask_on_decrypt=True)
- self.assertEqual(res, 'testing message! it is different')
+ res = self.client.decrypt_keyvalue([0, 1, 2], b"test", binascii.unhexlify("676faf8f13272af601776bc31bc14e8f3ae1c88536bf18f1b44f1e4c2c4a613d"), ask_on_encrypt=True, ask_on_decrypt=True)
+ self.assertEqual(res, b'testing message! it is different')
# different path
- res = self.client.decrypt_keyvalue([0, 1, 3], "test", binascii.unhexlify("b4811a9d492f5355a5186ddbfccaae7b"), ask_on_encrypt=True, ask_on_decrypt=True)
- self.assertEqual(res, 'testing message!')
+ res = self.client.decrypt_keyvalue([0, 1, 3], b"test", binascii.unhexlify("b4811a9d492f5355a5186ddbfccaae7b"), ask_on_encrypt=True, ask_on_decrypt=True)
+ self.assertEqual(res, b'testing message!')
def test_encrypt_badlen(self):
self.setup_mnemonic_nopin_nopassphrase()
- self.assertRaises(Exception, self.client.encrypt_keyvalue, [0, 1, 2], "test", "testing")
+ self.assertRaises(Exception, self.client.encrypt_keyvalue, [0, 1, 2], b"test", b"testing")
def test_decrypt_badlen(self):
self.setup_mnemonic_nopin_nopassphrase()
- self.assertRaises(Exception, self.client.decrypt_keyvalue, [0, 1, 2], "test", "testing")
+ self.assertRaises(Exception, self.client.decrypt_keyvalue, [0, 1, 2], b"test", b"testing")
if __name__ == '__main__':
unittest.main()
diff --git a/tests/test_msg_ethereum_getaddress.py b/tests/test_msg_ethereum_getaddress.py
new file mode 100644
index 0000000..8bbb0ba
--- /dev/null
+++ b/tests/test_msg_ethereum_getaddress.py
@@ -0,0 +1,17 @@
+import unittest
+import common
+import trezorlib.ckd_public as bip32
+import binascii
+
+class TestMsgEthereumGetaddress(common.TrezorTest):
+
+ def test_ethereum_getaddress(self):
+ self.setup_mnemonic_nopin_nopassphrase()
+ self.assertEqual(binascii.hexlify(self.client.ethereum_get_address([])), '1d1c328764a41bda0492b66baa30c4a339ff85ef')
+ self.assertEqual(binascii.hexlify(self.client.ethereum_get_address([1])), '437207ca3cf43bf2e47dea0756d736c5df4f597a')
+ self.assertEqual(binascii.hexlify(self.client.ethereum_get_address([0, -1])), 'e5d96dfa07bcf1a3ae43677840c31394258861bf')
+ self.assertEqual(binascii.hexlify(self.client.ethereum_get_address([-9, 0])), 'f68804ac9eca9483ab4241d3e4751590d2c05102')
+ self.assertEqual(binascii.hexlify(self.client.ethereum_get_address([0, 9999999])), '7a6366ecfcaf0d5dcc1539c171696c6cdd1eb8ed')
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/test_msg_ethereum_signtx.py b/tests/test_msg_ethereum_signtx.py
new file mode 100644
index 0000000..2e7b326
--- /dev/null
+++ b/tests/test_msg_ethereum_signtx.py
@@ -0,0 +1,139 @@
+import unittest
+import common
+import binascii
+
+import trezorlib.messages_pb2 as proto
+import trezorlib.types_pb2 as proto_types
+
+from rlp.utils import int_to_big_endian
+
+class TestMsgEthereumSigntx(common.TrezorTest):
+
+ def test_ethereum_signtx_nodata(self):
+ self.setup_mnemonic_nopin_nopassphrase()
+
+ sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
+ n=[0, 0],
+ nonce=0,
+ gas_price=20,
+ gas_limit=20,
+ to=binascii.unhexlify('1d1c328764a41bda0492b66baa30c4a339ff85ef'),
+ value=10)
+ self.assertEqual(sig_v, 27)
+ self.assertEqual(binascii.hexlify(sig_r), '9b61192a161d056c66cfbbd331edb2d783a0193bd4f65f49ee965f791d898f72')
+ self.assertEqual(binascii.hexlify(sig_s), '49c0bbe35131592c6ed5c871ac457feeb16a1493f64237387fab9b83c1a202f7')
+
+ sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
+ n=[0, 0],
+ nonce=123456,
+ gas_price=20000,
+ gas_limit=20000,
+ to=binascii.unhexlify('1d1c328764a41bda0492b66baa30c4a339ff85ef'),
+ value=12345678901234567890)
+ self.assertEqual(sig_v, 28)
+ self.assertEqual(binascii.hexlify(sig_r), '6de597b8ec1b46501e5b159676e132c1aa78a95bd5892ef23560a9867528975a')
+ self.assertEqual(binascii.hexlify(sig_s), '6e33c4230b1ecf96a8dbb514b4aec0a6d6ba53f8991c8143f77812aa6daa993f')
+
+ def test_ethereum_signtx_data(self):
+ self.setup_mnemonic_nopin_nopassphrase()
+
+ sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
+ n=[0, 0],
+ nonce=0,
+ gas_price=20,
+ gas_limit=20,
+ to=binascii.unhexlify('1d1c328764a41bda0492b66baa30c4a339ff85ef'),
+ value=10,
+ data='abcdefghijklmnop' * 16)
+ self.assertEqual(sig_v, 28)
+ self.assertEqual(binascii.hexlify(sig_r), '6da89ed8627a491bedc9e0382f37707ac4e5102e25e7a1234cb697cedb7cd2c0')
+ self.assertEqual(binascii.hexlify(sig_s), '691f73b145647623e2d115b208a7c3455a6a8a83e3b4db5b9c6d9bc75825038a')
+
+ sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
+ n=[0, 0],
+ nonce=123456,
+ gas_price=20000,
+ gas_limit=20000,
+ to=binascii.unhexlify('1d1c328764a41bda0492b66baa30c4a339ff85ef'),
+ value=12345678901234567890,
+ data='ABCDEFGHIJKLMNOP' * 256 + '!!!')
+ self.assertEqual(sig_v, 28)
+ self.assertEqual(binascii.hexlify(sig_r), '4e90b13c45c6a9bf4aaad0e5427c3e62d76692b36eb727c78d332441b7400404')
+ self.assertEqual(binascii.hexlify(sig_s), '3ff236e7d05f0f9b1ee3d70599bb4200638f28388a8faf6bb36db9e04dc544be')
+
+ def test_ethereum_signtx_message(self):
+ self.setup_mnemonic_nopin_nopassphrase()
+
+ sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
+ n=[0, 0],
+ nonce=0,
+ gas_price=20000,
+ gas_limit=20000,
+ to=binascii.unhexlify('1d1c328764a41bda0492b66baa30c4a339ff85ef'),
+ value=0,
+ data='ABCDEFGHIJKLMNOP' * 256 + '!!!')
+ self.assertEqual(sig_v, 28)
+ self.assertEqual(binascii.hexlify(sig_r), '070e9dafda4d9e733fa7b6747a75f8a4916459560efb85e3e73cd39f31aa160d')
+ self.assertEqual(binascii.hexlify(sig_s), '7842db33ef15c27049ed52741db41fe3238a6fa3a6a0888fcfb74d6917600e41')
+
+
+ def test_ethereum_signtx_newcontract(self):
+ self.setup_mnemonic_nopin_nopassphrase()
+
+ # contract creation without data should fail.
+ self.assertRaises(Exception, self.client.ethereum_sign_tx,
+ n=[0, 0],
+ nonce=123456,
+ gas_price=20000,
+ gas_limit=20000,
+ to='',
+ value=12345678901234567890)
+
+ sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
+ n=[0, 0],
+ nonce=0,
+ gas_price=20000,
+ gas_limit=20000,
+ to='',
+ value=12345678901234567890,
+ data='ABCDEFGHIJKLMNOP' * 256 + '!!!')
+ self.assertEqual(sig_v, 28)
+ self.assertEqual(binascii.hexlify(sig_r), 'b401884c10ae435a2e792303b5fc257a09f94403b2883ad8c0ac7a7282f5f1f9')
+ self.assertEqual(binascii.hexlify(sig_s), '4742fc9e6a5fa8db3db15c2d856914a7f3daab21603a6c1ce9e9927482f8352e')
+
+ def test_ethereum_sanity_checks(self):
+ # gas overflow
+ self.assertRaises(Exception, self.client.ethereum_sign_tx,
+ n=[0, 0],
+ nonce=123456,
+ gas_price=0xffffffffffffffffffffffffffffffff,
+ gas_limit=0xffffffffffffffffffffffffffffff,
+ to=binascii.unhexlify('1d1c328764a41bda0492b66baa30c4a339ff85ef'),
+ value=12345678901234567890)
+
+ # no gas price
+ self.assertRaises(Exception, self.client.ethereum_sign_tx,
+ n=[0, 0],
+ nonce=123456,
+ gas_limit=10000,
+ to=binascii.unhexlify('1d1c328764a41bda0492b66baa30c4a339ff85ef'),
+ value=12345678901234567890)
+
+ # no gas limit
+ self.assertRaises(Exception, self.client.ethereum_sign_tx,
+ n=[0, 0],
+ nonce=123456,
+ gas_price=10000,
+ to=binascii.unhexlify('1d1c328764a41bda0492b66baa30c4a339ff85ef'),
+ value=12345678901234567890)
+
+ # no nonce
+ self.assertRaises(Exception, self.client.ethereum_sign_tx,
+ n=[0, 0],
+ gas_price=10000,
+ gas_limit=123456,
+ to=binascii.unhexlify('1d1c328764a41bda0492b66baa30c4a339ff85ef'),
+ value=12345678901234567890)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/test_msg_getaddress_show.py b/tests/test_msg_getaddress_show.py
index c3ac1c9..a4e704e 100644
--- a/tests/test_msg_getaddress_show.py
+++ b/tests/test_msg_getaddress_show.py
@@ -20,7 +20,7 @@ class TestMsgGetaddress(common.TrezorTest):
pubkeys=[proto_types.HDNodePathType(node=node, address_n=[1]),
proto_types.HDNodePathType(node=node, address_n=[2]),
proto_types.HDNodePathType(node=node, address_n=[3])],
- signatures=['', '', ''],
+ signatures=[b'', b'', b''],
m=2,
)
@@ -38,7 +38,7 @@ class TestMsgGetaddress(common.TrezorTest):
multisig = proto_types.MultisigRedeemScriptType(
pubkeys=pubs,
- signatures=[''] * 15,
+ signatures=[b''] * 15,
m=15,
)
diff --git a/tests/test_msg_getentropy.py b/tests/test_msg_getentropy.py
index f36ec9b..329bd74 100644
--- a/tests/test_msg_getentropy.py
+++ b/tests/test_msg_getentropy.py
@@ -15,7 +15,7 @@ def entropy(data):
else:
counts[c] = 1
e = 0
- for _, v in counts.iteritems():
+ for _, v in counts.items():
p = 1.0 * v / len(data)
e -= p * math.log(p, 256)
return e
diff --git a/tests/test_msg_loaddevice.py b/tests/test_msg_loaddevice.py
index 96b78a2..9894312 100644
--- a/tests/test_msg_loaddevice.py
+++ b/tests/test_msg_loaddevice.py
@@ -17,8 +17,12 @@ class TestDeviceLoad(common.TrezorTest):
passphrase_protection = self.client.debug.read_passphrase_protection()
self.assertEqual(passphrase_protection, False)
+ address = self.client.get_address('Bitcoin', [])
+ self.assertEqual(address, '1EfKbQupktEMXf4gujJ9kCFo83k1iMqwqK')
+
def test_load_device_2(self):
self.setup_mnemonic_pin_passphrase()
+ self.client.set_passphrase('passphrase')
mnemonic = self.client.debug.read_mnemonic()
self.assertEqual(mnemonic, self.mnemonic12)
@@ -29,6 +33,9 @@ class TestDeviceLoad(common.TrezorTest):
passphrase_protection = self.client.debug.read_passphrase_protection()
self.assertEqual(passphrase_protection, True)
+ address = self.client.get_address('Bitcoin', [])
+ self.assertEqual(address, '15fiTDFwZd2kauHYYseifGi9daH2wniDHH')
+
def test_load_device_3(self):
self.client.load_device_by_xprv(xprv='xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8imbZKLYVBxFPND1pniTZ81vKfd45EHKX73', pin='', passphrase_protection=False, label='test', language='english')
diff --git a/tests/test_msg_resetdevice.py b/tests/test_msg_resetdevice.py
index bfca2be..353aa94 100644
--- a/tests/test_msg_resetdevice.py
+++ b/tests/test_msg_resetdevice.py
@@ -26,7 +26,7 @@ def generate_entropy(strength, internal_entropy, external_entropy):
raise Exception("External entropy too short")
entropy = hashlib.sha256(internal_entropy + external_entropy).digest()
- entropy_stripped = entropy[:strength / 8]
+ entropy_stripped = entropy[:strength // 8]
if len(entropy_stripped) * 8 != strength:
raise Exception("Entropy length mismatch")
@@ -36,7 +36,7 @@ def generate_entropy(strength, internal_entropy, external_entropy):
class TestDeviceReset(common.TrezorTest):
def test_reset_device(self):
# No PIN, no passphrase
- external_entropy = 'zlutoucky kun upel divoke ody' * 2
+ external_entropy = b'zlutoucky kun upel divoke ody' * 2
strength = 128
ret = self.client.call_raw(proto.ResetDevice(display_random=False,
@@ -56,7 +56,7 @@ class TestDeviceReset(common.TrezorTest):
expected_mnemonic = Mnemonic('english').to_mnemonic(entropy)
mnemonic = []
- for _ in range(strength/32*3):
+ for _ in range(strength//32*3):
self.assertIsInstance(ret, proto.ButtonRequest)
mnemonic.append(self.client.debug.read_reset_word())
self.client.debug.press_yes()
@@ -68,7 +68,7 @@ class TestDeviceReset(common.TrezorTest):
self.assertEqual(mnemonic, expected_mnemonic)
mnemonic = []
- for _ in range(strength/32*3):
+ for _ in range(strength//32*3):
self.assertIsInstance(ret, proto.ButtonRequest)
mnemonic.append(self.client.debug.read_reset_word())
self.client.debug.press_yes()
@@ -95,7 +95,7 @@ class TestDeviceReset(common.TrezorTest):
self.assertIsInstance(resp, proto.Success)
def test_reset_device_pin(self):
- external_entropy = 'zlutoucky kun upel divoke ody' * 2
+ external_entropy = b'zlutoucky kun upel divoke ody' * 2
strength = 128
ret = self.client.call_raw(proto.ResetDevice(display_random=True,
@@ -130,7 +130,7 @@ class TestDeviceReset(common.TrezorTest):
expected_mnemonic = Mnemonic('english').to_mnemonic(entropy)
mnemonic = []
- for _ in range(strength/32*3):
+ for _ in range(strength//32*3):
self.assertIsInstance(ret, proto.ButtonRequest)
mnemonic.append(self.client.debug.read_reset_word())
self.client.debug.press_yes()
@@ -142,7 +142,7 @@ class TestDeviceReset(common.TrezorTest):
self.assertEqual(mnemonic, expected_mnemonic)
mnemonic = []
- for _ in range(strength/32*3):
+ for _ in range(strength//32*3):
self.assertIsInstance(ret, proto.ButtonRequest)
mnemonic.append(self.client.debug.read_reset_word())
self.client.debug.press_yes()
@@ -171,7 +171,7 @@ class TestDeviceReset(common.TrezorTest):
self.client.call_raw(proto.Cancel())
def test_failed_pin(self):
- external_entropy = 'zlutoucky kun upel divoke ody' * 2
+ external_entropy = b'zlutoucky kun upel divoke ody' * 2
strength = 128
ret = self.client.call_raw(proto.ResetDevice(display_random=True,
diff --git a/tests/test_msg_signidentity.py b/tests/test_msg_signidentity.py
index 6d093ad..28fe24d 100644
--- a/tests/test_msg_signidentity.py
+++ b/tests/test_msg_signidentity.py
@@ -38,8 +38,8 @@ class TestMsgSignidentity(common.TrezorTest):
identity = proto_types.IdentityType(proto='https', user='satoshi', host='bitcoin.org', port='', path='/login', index=0)
sig = self.client.sign_identity(identity, hidden, visual)
self.assertEqual(sig.address, '17F17smBTX9VTZA9Mj8LM5QGYNZnmziCjL')
- self.assertEqual(binascii.hexlify(sig.public_key), '023a472219ad3327b07c18273717bb3a40b39b743756bf287fbd5fa9d263237f45')
- self.assertEqual(binascii.hexlify(sig.signature), '20f2d1a42d08c3a362be49275c3ffeeaa415fc040971985548b9f910812237bb41770bf2c8d488428799fbb7e52c11f1a3404011375e4080e077e0e42ab7a5ba02')
+ self.assertEqual(binascii.hexlify(sig.public_key), b'023a472219ad3327b07c18273717bb3a40b39b743756bf287fbd5fa9d263237f45')
+ self.assertEqual(binascii.hexlify(sig.signature), b'20f2d1a42d08c3a362be49275c3ffeeaa415fc040971985548b9f910812237bb41770bf2c8d488428799fbb7e52c11f1a3404011375e4080e077e0e42ab7a5ba02')
# URI : ftp://satoshi@bitcoin.org:2323/pub
# hash : 79a6b53831c6ff224fb283587adc4ebae8fb0d734734a46c876838f52dff53f3
@@ -47,8 +47,8 @@ class TestMsgSignidentity(common.TrezorTest):
identity = proto_types.IdentityType(proto='ftp', user='satoshi', host='bitcoin.org', port='2323', path='/pub', index=3)
sig = self.client.sign_identity(identity, hidden, visual)
self.assertEqual(sig.address, '1KAr6r5qF2kADL8bAaRQBjGKYEGxn9WrbS')
- self.assertEqual(binascii.hexlify(sig.public_key), '0266cf12d2ba381c5fd797da0d64f59c07a6f1b034ad276cca6bf2729e92b20d9c')
- self.assertEqual(binascii.hexlify(sig.signature), '20bbd12dc657d534fc0f7e40186e22c447e0866a016f654f380adffa9a84e9faf412a1bb0ae908296537838cf91145e77da08681c63d07b7dca40728b9e6cb17cf')
+ self.assertEqual(binascii.hexlify(sig.public_key), b'0266cf12d2ba381c5fd797da0d64f59c07a6f1b034ad276cca6bf2729e92b20d9c')
+ self.assertEqual(binascii.hexlify(sig.signature), b'20bbd12dc657d534fc0f7e40186e22c447e0866a016f654f380adffa9a84e9faf412a1bb0ae908296537838cf91145e77da08681c63d07b7dca40728b9e6cb17cf')
# URI : ssh://satoshi@bitcoin.org
# hash : 5fa612f558a1a3b1fb7f010b2ea0a25cb02520a0ffa202ce74a92fc6145da5f3
@@ -56,8 +56,8 @@ class TestMsgSignidentity(common.TrezorTest):
identity = proto_types.IdentityType(proto='ssh', user='satoshi', host='bitcoin.org', port='', path='', index=47)
sig = self.client.sign_identity(identity, hidden, visual, ecdsa_curve_name='nist256p1')
self.assertEqual(sig.address, '')
- self.assertEqual(binascii.hexlify(sig.public_key), '0373f21a3da3d0e96fc2189f81dd826658c3d76b2d55bd1da349bc6c3573b13ae4')
- self.assertEqual(binascii.hexlify(sig.signature), '005122cebabb852cdd32103b602662afa88e54c0c0c1b38d7099c64dcd49efe908288114e66ed2d8c82f23a70b769a4db723173ec53840c08aafb840d3f09a18d3')
+ self.assertEqual(binascii.hexlify(sig.public_key), b'0373f21a3da3d0e96fc2189f81dd826658c3d76b2d55bd1da349bc6c3573b13ae4')
+ self.assertEqual(binascii.hexlify(sig.signature), b'005122cebabb852cdd32103b602662afa88e54c0c0c1b38d7099c64dcd49efe908288114e66ed2d8c82f23a70b769a4db723173ec53840c08aafb840d3f09a18d3')
# URI : ssh://satoshi@bitcoin.org
# hash : 5fa612f558a1a3b1fb7f010b2ea0a25cb02520a0ffa202ce74a92fc6145da5f3
@@ -65,8 +65,8 @@ class TestMsgSignidentity(common.TrezorTest):
identity = proto_types.IdentityType(proto='ssh', user='satoshi', host='bitcoin.org', port='', path='', index=47)
sig = self.client.sign_identity(identity, hidden, visual, ecdsa_curve_name='ed25519')
self.assertEqual(sig.address, '')
- self.assertEqual(binascii.hexlify(sig.public_key), '000fac2a491e0f5b871dc48288a4cae551bac5cb0ed19df0764d6e721ec5fade18')
- self.assertEqual(binascii.hexlify(sig.signature), '00f05e5085e666429de397c70a081932654369619c0bd2a6579ea6c1ef2af112ef79998d6c862a16b932d44b1ac1b83c8cbcd0fbda228274fde9e0d0ca6e9cb709')
+ self.assertEqual(binascii.hexlify(sig.public_key), b'000fac2a491e0f5b871dc48288a4cae551bac5cb0ed19df0764d6e721ec5fade18')
+ self.assertEqual(binascii.hexlify(sig.signature), b'00f05e5085e666429de397c70a081932654369619c0bd2a6579ea6c1ef2af112ef79998d6c862a16b932d44b1ac1b83c8cbcd0fbda228274fde9e0d0ca6e9cb709')
if __name__ == '__main__':
diff --git a/tests/test_msg_signmessage.py b/tests/test_msg_signmessage.py
index de96d1d..f578d5f 100644
--- a/tests/test_msg_signmessage.py
+++ b/tests/test_msg_signmessage.py
@@ -10,22 +10,21 @@ class TestMsgSignmessage(common.TrezorTest):
self.setup_mnemonic_nopin_nopassphrase()
sig = self.client.sign_message('Bitcoin', [0], "This is an example of a signed message.")
self.assertEqual(sig.address, '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e')
- self.assertEqual(binascii.hexlify(sig.signature), '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80')
+ self.assertEqual(binascii.hexlify(sig.signature), b'209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80')
def test_sign_testnet(self):
self.setup_mnemonic_nopin_nopassphrase()
sig = self.client.sign_message('Testnet', [0], "This is an example of a signed message.")
self.assertEqual(sig.address, 'mirio8q3gtv7fhdnmb3TpZ4EuafdzSs7zL')
- self.assertEqual(binascii.hexlify(sig.signature), '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80')
+ self.assertEqual(binascii.hexlify(sig.signature), b'209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80')
def test_sign_long(self):
self.setup_mnemonic_nopin_nopassphrase()
sig = self.client.sign_message('Bitcoin', [0], "VeryLongMessage!" * 64)
self.assertEqual(sig.address, '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e')
- self.assertEqual(binascii.hexlify(sig.signature), '205ff795c29aef7538f8b3bdb2e8add0d0722ad630a140b6aefd504a5a895cbd867cbb00981afc50edd0398211e8d7c304bb8efa461181bc0afa67ea4a720a89ed')
+ self.assertEqual(binascii.hexlify(sig.signature), b'205ff795c29aef7538f8b3bdb2e8add0d0722ad630a140b6aefd504a5a895cbd867cbb00981afc50edd0398211e8d7c304bb8efa461181bc0afa67ea4a720a89ed')
- """
def test_sign_utf(self):
self.setup_mnemonic_nopin_nopassphrase()
@@ -34,12 +33,11 @@ class TestMsgSignmessage(common.TrezorTest):
sig_nfkd = self.client.sign_message('Bitcoin', [0], words_nfkd)
self.assertEqual(sig_nfkd.address, '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e')
- self.assertEqual(binascii.hexlify(sig_nfkd.signature), '1fd0ec02ed8da8df23e7fe9e680e7867cc290312fe1c970749d8306ddad1a1eda4e39588e4ec2b6a22dda4ec4f562f06e91129eea9a844a7193812de82d47c496b')
+ self.assertEqual(binascii.hexlify(sig_nfkd.signature), b'20d0ec02ed8da8df23e7fe9e680e7867cc290312fe1c970749d8306ddad1a1eda41c6a771b13d495dd225b13b0a9d0f915a984ee3d0703f92287bf8009fbb9f7d6')
sig_nfc = self.client.sign_message('Bitcoin', [0], words_nfc)
self.assertEqual(sig_nfc.address, '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e')
- self.assertEqual(binascii.hexlify(sig_nfc.signature), '1fd0ec02ed8da8df23e7fe9e680e7867cc290312fe1c970749d8306ddad1a1eda4e39588e4ec2b6a22dda4ec4f562f06e91129eea9a844a7193812de82d47c496b')
- """
+ self.assertEqual(binascii.hexlify(sig_nfc.signature), b'20d0ec02ed8da8df23e7fe9e680e7867cc290312fe1c970749d8306ddad1a1eda41c6a771b13d495dd225b13b0a9d0f915a984ee3d0703f92287bf8009fbb9f7d6')
if __name__ == '__main__':
unittest.main()
diff --git a/tests/test_msg_signtx.py b/tests/test_msg_signtx.py
index 4fee5cc..16918f9 100644
--- a/tests/test_msg_signtx.py
+++ b/tests/test_msg_signtx.py
@@ -1,7 +1,6 @@
import unittest
import common
import binascii
-import itertools
import trezorlib.messages_pb2 as proto
import trezorlib.types_pb2 as proto_types
@@ -17,7 +16,7 @@ class TestMsgSigntx(common.TrezorTest):
inp1 = proto_types.TxInputType(address_n=[0], # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e
# amount=390000,
- prev_hash=binascii.unhexlify('d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882'),
+ prev_hash=binascii.unhexlify(b'd5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882'),
prev_index=0,
)
@@ -29,10 +28,10 @@ class TestMsgSigntx(common.TrezorTest):
with self.client:
self.client.set_expected_responses([
proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0)),
- proto.TxRequest(request_type=proto_types.TXMETA, details=proto_types.TxRequestDetailsType(tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
- proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
- proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
- proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXMETA, details=proto_types.TxRequestDetailsType(tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0)),
proto.ButtonRequest(code=proto_types.ButtonRequest_ConfirmOutput),
proto.ButtonRequest(code=proto_types.ButtonRequest_SignTx),
@@ -45,7 +44,7 @@ class TestMsgSigntx(common.TrezorTest):
(signatures, serialized_tx) = self.client.sign_tx('Bitcoin', [inp1, ], [out1, ])
# Accepted by network: tx fd79435246dee76b2f159d2db08032d666c95adc544de64c8c49f474df4a7fee
- self.assertEqual(binascii.hexlify(serialized_tx), '010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b4830450221009a0b7be0d4ed3146ee262b42202841834698bb3ee39c24e7437df208b8b7077102202b79ab1e7736219387dffe8d615bbdba87e11477104b867ef47afed1a5ede7810121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0160cc0500000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000')
+ self.assertEqual(binascii.hexlify(serialized_tx), b'010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b4830450221009a0b7be0d4ed3146ee262b42202841834698bb3ee39c24e7437df208b8b7077102202b79ab1e7736219387dffe8d615bbdba87e11477104b867ef47afed1a5ede7810121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0160cc0500000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000')
def test_testnet_one_two_fee(self):
self.setup_mnemonic_nopin_nopassphrase()
@@ -54,7 +53,7 @@ class TestMsgSigntx(common.TrezorTest):
# input 1: 10.00000000 BTC
inp1 = proto_types.TxInputType(address_n=[0], # mirio8q3gtv7fhdnmb3TpZ4EuafdzSs7zL
# amount=1000000000,
- prev_hash=binascii.unhexlify('6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54'),
+ prev_hash=binascii.unhexlify(b'6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54'),
prev_index=1,
)
@@ -72,11 +71,11 @@ class TestMsgSigntx(common.TrezorTest):
self.client.set_tx_api(TXAPITestnet())
self.client.set_expected_responses([
proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0)),
- proto.TxRequest(request_type=proto_types.TXMETA, details=proto_types.TxRequestDetailsType(tx_hash=binascii.unhexlify("6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
- proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify("6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
- proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify("6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
- proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify("6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
- proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify("6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
+ proto.TxRequest(request_type=proto_types.TXMETA, details=proto_types.TxRequestDetailsType(tx_hash=binascii.unhexlify(b"6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
+ proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify(b"6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
+ proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify(b"6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
+ proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify(b"6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
+ proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify(b"6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0)),
proto.ButtonRequest(code=proto_types.ButtonRequest_ConfirmOutput),
proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=1)),
@@ -90,7 +89,7 @@ class TestMsgSigntx(common.TrezorTest):
])
(signatures, serialized_tx) = self.client.sign_tx('Testnet', [inp1, ], [out1, out2])
- self.assertEqual(binascii.hexlify(serialized_tx), '0100000001549d2977998f899a63c0a9da30dedb2841e33fef561097b05822eccbc7f3906f010000006b4830450221009c2d30385519fdb13dce13d5ac038be07d7b2dad0b0f7b2c1c339d7255bcf553022056a2f5bceab3cd0ffed4d388387e631f419d67ff9ce7798e3d7dfe6a6d6ec4bd0121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0280ce341d000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac0065cd1d000000001976a9142db345c36563122e2fd0f5485fb7ea9bb [...]
+ self.assertEqual(binascii.hexlify(serialized_tx), b'0100000001549d2977998f899a63c0a9da30dedb2841e33fef561097b05822eccbc7f3906f010000006b4830450221009c2d30385519fdb13dce13d5ac038be07d7b2dad0b0f7b2c1c339d7255bcf553022056a2f5bceab3cd0ffed4d388387e631f419d67ff9ce7798e3d7dfe6a6d6ec4bd0121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0280ce341d000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac0065cd1d000000001976a9142db345c36563122e2fd0f5485fb7ea9b [...]
def test_testnet_fee_too_high(self):
self.setup_mnemonic_nopin_nopassphrase()
@@ -117,11 +116,11 @@ class TestMsgSigntx(common.TrezorTest):
self.client.set_tx_api(TXAPITestnet())
self.client.set_expected_responses([
proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0)),
- proto.TxRequest(request_type=proto_types.TXMETA, details=proto_types.TxRequestDetailsType(tx_hash=binascii.unhexlify("6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
- proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify("6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
- proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify("6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
- proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify("6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
- proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify("6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
+ proto.TxRequest(request_type=proto_types.TXMETA, details=proto_types.TxRequestDetailsType(tx_hash=binascii.unhexlify(b"6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
+ proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify(b"6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
+ proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify(b"6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
+ proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify(b"6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
+ proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify(b"6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54"))),
proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0)),
proto.ButtonRequest(code=proto_types.ButtonRequest_ConfirmOutput),
proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=1)),
@@ -136,7 +135,7 @@ class TestMsgSigntx(common.TrezorTest):
])
(signatures, serialized_tx) = self.client.sign_tx('Testnet', [inp1, ], [out1, out2])
- self.assertEqual(binascii.hexlify(serialized_tx), '0100000001549d2977998f899a63c0a9da30dedb2841e33fef561097b05822eccbc7f3906f010000006a47304402205ea68e9d52d4be14420ccecf7f2e11489d49b86bedb79ee99b5e9b7188884150022056219cb3384a5df8048cca286a9533403dbda1571afd84b51379cdaee6a6dea80121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff020084d717000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac0065cd1d000000001976a9142db345c36563122e2fd0f5485fb7ea9bbf7 [...]
+ self.assertEqual(binascii.hexlify(serialized_tx), b'0100000001549d2977998f899a63c0a9da30dedb2841e33fef561097b05822eccbc7f3906f010000006a47304402205ea68e9d52d4be14420ccecf7f2e11489d49b86bedb79ee99b5e9b7188884150022056219cb3384a5df8048cca286a9533403dbda1571afd84b51379cdaee6a6dea80121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff020084d717000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac0065cd1d000000001976a9142db345c36563122e2fd0f5485fb7ea9bbf [...]
def test_one_two_fee(self):
self.setup_mnemonic_nopin_nopassphrase()
@@ -163,10 +162,10 @@ class TestMsgSigntx(common.TrezorTest):
with self.client:
self.client.set_expected_responses([
proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0)),
- proto.TxRequest(request_type=proto_types.TXMETA, details=proto_types.TxRequestDetailsType(tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
- proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
- proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
- proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXMETA, details=proto_types.TxRequestDetailsType(tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0)),
proto.ButtonRequest(code=proto_types.ButtonRequest_ConfirmOutput),
proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=1)),
@@ -180,7 +179,7 @@ class TestMsgSigntx(common.TrezorTest):
])
(signatures, serialized_tx) = self.client.sign_tx('Bitcoin', [inp1, ], [out1, out2])
- self.assertEqual(binascii.hexlify(serialized_tx), '010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b483045022100c1400d8485d3bdcae7413e123148f35ece84806fc387ab88c66b469df89aef1702201d481d04216b319dc549ffe2333143629ba18828a4e2d1783ab719a6aa263eb70121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff02e0930400000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac80380100000000001976a9140223b1a09138753c9cb0baf95a0a62c82 [...]
+ self.assertEqual(binascii.hexlify(serialized_tx), b'010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b483045022100c1400d8485d3bdcae7413e123148f35ece84806fc387ab88c66b469df89aef1702201d481d04216b319dc549ffe2333143629ba18828a4e2d1783ab719a6aa263eb70121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff02e0930400000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac80380100000000001976a9140223b1a09138753c9cb0baf95a0a62c8 [...]
def test_one_three_fee(self):
self.setup_mnemonic_nopin_nopassphrase()
@@ -212,10 +211,10 @@ class TestMsgSigntx(common.TrezorTest):
with self.client:
self.client.set_expected_responses([
proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0)),
- proto.TxRequest(request_type=proto_types.TXMETA, details=proto_types.TxRequestDetailsType(tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
- proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
- proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
- proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify("d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXMETA, details=proto_types.TxRequestDetailsType(tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXINPUT, details=proto_types.TxRequestDetailsType(request_index=1, tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
+ proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0, tx_hash=binascii.unhexlify(b"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"))),
proto.TxRequest(request_type=proto_types.TXOUTPUT, details=proto_types.TxRequestDetailsType(request_index=0)),
... 4193 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-trezor.git
More information about the Python-modules-commits
mailing list