don't use simplesigntx in tests where signtx can be used
This commit is contained in:
parent
1038a0a3e6
commit
f17f7d0569
|
@ -25,7 +25,7 @@ class TestMsgEstimatetxsize(common.TrezorTest):
|
||||||
est_size = self.client.estimate_tx_size('Bitcoin', [inp1, ], [out1, ])
|
est_size = self.client.estimate_tx_size('Bitcoin', [inp1, ], [out1, ])
|
||||||
self.assertEqual(est_size, 194)
|
self.assertEqual(est_size, 194)
|
||||||
|
|
||||||
tx = self.client.simple_sign_tx('Bitcoin', [inp1, ], [out1, ])
|
(_, tx) = self.client.sign_tx('Bitcoin', [inp1, ], [out1, ])
|
||||||
real_size = len(tx)
|
real_size = len(tx)
|
||||||
|
|
||||||
self.assertGreaterEqual(est_size, real_size)
|
self.assertGreaterEqual(est_size, real_size)
|
||||||
|
|
|
@ -6,8 +6,6 @@ from trezorlib import messages_pb2 as proto
|
||||||
from trezorlib import types_pb2 as proto_types
|
from trezorlib import types_pb2 as proto_types
|
||||||
|
|
||||||
class TestProtectionLevels(common.TrezorTest):
|
class TestProtectionLevels(common.TrezorTest):
|
||||||
# Tests protection levels of all messages as defined here:
|
|
||||||
# https://github.com/trezor/documentation/wiki/Protection-Levels
|
|
||||||
|
|
||||||
def test_initialize(self):
|
def test_initialize(self):
|
||||||
with self.client:
|
with self.client:
|
||||||
|
@ -130,9 +128,7 @@ class TestProtectionLevels(common.TrezorTest):
|
||||||
self.client.set_expected_responses([proto.TxSize()])
|
self.client.set_expected_responses([proto.TxSize()])
|
||||||
self.client.estimate_tx_size('Bitcoin', [], [])
|
self.client.estimate_tx_size('Bitcoin', [], [])
|
||||||
|
|
||||||
#def test_signtx(self):
|
"""
|
||||||
# pass
|
|
||||||
|
|
||||||
def test_simplesigntx(self):
|
def test_simplesigntx(self):
|
||||||
self.setup_mnemonic_pin_passphrase()
|
self.setup_mnemonic_pin_passphrase()
|
||||||
|
|
||||||
|
@ -153,6 +149,7 @@ class TestProtectionLevels(common.TrezorTest):
|
||||||
proto.ButtonRequest(code=proto_types.ButtonRequest_SignTx),
|
proto.ButtonRequest(code=proto_types.ButtonRequest_SignTx),
|
||||||
proto.TxRequest(request_type=proto_types.TXFINISHED)])
|
proto.TxRequest(request_type=proto_types.TXFINISHED)])
|
||||||
self.client.simple_sign_tx('Bitcoin', [inp1, ], [out1, ])
|
self.client.simple_sign_tx('Bitcoin', [inp1, ], [out1, ])
|
||||||
|
"""
|
||||||
|
|
||||||
def test_signtx(self):
|
def test_signtx(self):
|
||||||
self.setup_mnemonic_pin_passphrase()
|
self.setup_mnemonic_pin_passphrase()
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
'''
|
|
||||||
TODO: Test private key generation.
|
|
||||||
Requires changes in DebugLink protocol
|
|
||||||
|
|
||||||
address N -> secexp
|
|
||||||
1KqYyzL53R8oA1LdYvyv7m6JUryFfGJDpa 0 -> 58076025150540604300740730208658111746901313722419801903949973414685471840010
|
|
||||||
13MzKU6YjjdyiW3dZJDa5VU4AWGczQsdYD 2 -> 24964362473980156971921866787933161040275203024491680251157021262214416818504
|
|
||||||
1FQVPnjrbkPWeA8poUoEnX9U3n9DyhAVtv 3 -> 12500609616964965377900270839876716803428136543899720278159495092510064965376
|
|
||||||
1C9DHmWBpvGcFKXEiWWC3EK3EY5Bj79nze 9 -> 67160564554915396199427939496499570939355460294705808200742756759419289432145
|
|
||||||
'''
|
|
|
@ -20,7 +20,7 @@ class TestZeroSig(common.TrezorTest):
|
||||||
prev_index=0,
|
prev_index=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1, ], [])
|
msg = self.client._prepare_sign_tx('Bitcoin', [inp1, ], [])
|
||||||
|
|
||||||
for n in range(3500, 200000):
|
for n in range(3500, 200000):
|
||||||
out1 = proto_types.TxOutputType(address_n=[n],
|
out1 = proto_types.TxOutputType(address_n=[n],
|
||||||
|
@ -55,9 +55,8 @@ class TestZeroSig(common.TrezorTest):
|
||||||
script_type=proto_types.PAYTOADDRESS,
|
script_type=proto_types.PAYTOADDRESS,
|
||||||
)
|
)
|
||||||
|
|
||||||
msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1], [out1])
|
(signatures, serialized_tx) = self.client.sign_tx('Bitcoin', [inp1, ], [out1, ])
|
||||||
tx = self.client.call(msg)
|
siglen = ord(serialized_tx[44])
|
||||||
siglen = ord(tx.serialized.serialized_tx[44])
|
|
||||||
|
|
||||||
# Trezor must strip leading zero from signature
|
# Trezor must strip leading zero from signature
|
||||||
self.assertEqual(siglen, 67)
|
self.assertEqual(siglen, 67)
|
||||||
|
@ -77,9 +76,8 @@ class TestZeroSig(common.TrezorTest):
|
||||||
script_type=proto_types.PAYTOADDRESS,
|
script_type=proto_types.PAYTOADDRESS,
|
||||||
)
|
)
|
||||||
|
|
||||||
msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1], [out1])
|
(signatures, serialized_tx) = self.client.sign_tx('Bitcoin', [inp1, ], [out1, ])
|
||||||
tx = self.client.call(msg)
|
siglen = ord(serialized_tx[44])
|
||||||
siglen = ord(tx.serialized.serialized_tx[44])
|
|
||||||
|
|
||||||
# Trezor must strip leading zero from signature
|
# Trezor must strip leading zero from signature
|
||||||
self.assertEqual(siglen, 66)
|
self.assertEqual(siglen, 66)
|
||||||
|
|
Loading…
Reference in New Issue