mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
tests: cleanup lisk tests
This commit is contained in:
parent
3831ddd5a9
commit
73c8a1c11f
@ -19,7 +19,6 @@ env:
|
||||
PROTOBUF_VERSION=3.4.0
|
||||
|
||||
python:
|
||||
- "3.4"
|
||||
- "3.5"
|
||||
- "3.6"
|
||||
|
||||
|
@ -20,13 +20,11 @@ from trezorlib import lisk
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from .common import TrezorTest
|
||||
from .conftest import TREZOR_VERSION
|
||||
|
||||
LISK_PATH = parse_path("m/44h/134h/0h/1h")
|
||||
|
||||
|
||||
@pytest.mark.lisk
|
||||
@pytest.mark.xfail(TREZOR_VERSION == 1, reason="waiting for PR#351")
|
||||
class TestMsgLiskGetaddress(TrezorTest):
|
||||
def test_lisk_getaddress(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
|
@ -14,26 +14,22 @@
|
||||
# You should have received a copy of the License along with this library.
|
||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||
|
||||
from binascii import hexlify
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import lisk
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from .common import TrezorTest
|
||||
from .conftest import TREZOR_VERSION
|
||||
|
||||
LISK_PATH = parse_path("m/44h/134h/0h/0h")
|
||||
|
||||
|
||||
@pytest.mark.lisk
|
||||
@pytest.mark.xfail(TREZOR_VERSION == 1, reason="waiting for PR#351")
|
||||
class TestMsgLiskGetPublicKey(TrezorTest):
|
||||
def test_lisk_get_public_key(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
sig = lisk.get_public_key(self.client, LISK_PATH)
|
||||
assert (
|
||||
hexlify(sig.public_key)
|
||||
== b"eb56d7bbb5e8ea9269405f7a8527fe126023d1db2c973cfac6f760b60ae27294"
|
||||
sig.public_key.hex()
|
||||
== "eb56d7bbb5e8ea9269405f7a8527fe126023d1db2c973cfac6f760b60ae27294"
|
||||
)
|
||||
|
@ -14,21 +14,17 @@
|
||||
# You should have received a copy of the License along with this library.
|
||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||
|
||||
from binascii import hexlify
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import lisk
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from .common import TrezorTest
|
||||
from .conftest import TREZOR_VERSION
|
||||
|
||||
LISK_PATH = parse_path("m/44h/134h/0h/0h")
|
||||
|
||||
|
||||
@pytest.mark.lisk
|
||||
@pytest.mark.xfail(TREZOR_VERSION == 1, reason="waiting for PR#351")
|
||||
class TestMsgLiskSignmessage(TrezorTest):
|
||||
def test_sign(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
@ -36,22 +32,22 @@ class TestMsgLiskSignmessage(TrezorTest):
|
||||
self.client, LISK_PATH, "This is an example of a signed message."
|
||||
)
|
||||
assert (
|
||||
hexlify(sig.public_key)
|
||||
== b"eb56d7bbb5e8ea9269405f7a8527fe126023d1db2c973cfac6f760b60ae27294"
|
||||
sig.public_key.hex()
|
||||
== "eb56d7bbb5e8ea9269405f7a8527fe126023d1db2c973cfac6f760b60ae27294"
|
||||
)
|
||||
assert (
|
||||
hexlify(sig.signature)
|
||||
== b"7858ae7cd52ea6d4b17e800ca60144423db5560bfd618b663ffbf26ab66758563df45cbffae8463db22dc285dd94309083b8c807776085b97d05374d79867d05"
|
||||
sig.signature.hex()
|
||||
== "7858ae7cd52ea6d4b17e800ca60144423db5560bfd618b663ffbf26ab66758563df45cbffae8463db22dc285dd94309083b8c807776085b97d05374d79867d05"
|
||||
)
|
||||
|
||||
def test_sign_long(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
sig = lisk.sign_message(self.client, LISK_PATH, "VeryLongMessage!" * 64)
|
||||
assert (
|
||||
hexlify(sig.public_key)
|
||||
== b"eb56d7bbb5e8ea9269405f7a8527fe126023d1db2c973cfac6f760b60ae27294"
|
||||
sig.public_key.hex()
|
||||
== "eb56d7bbb5e8ea9269405f7a8527fe126023d1db2c973cfac6f760b60ae27294"
|
||||
)
|
||||
assert (
|
||||
hexlify(sig.signature)
|
||||
== b"19c26f4b6f2ecf2feef57d22237cf97eb7862fdc2fb8c303878843f5dd728191f7837cf8d0ed41f8e470b15181223a3a5131881add9c22b2453b01be4edef104"
|
||||
sig.signature.hex()
|
||||
== "19c26f4b6f2ecf2feef57d22237cf97eb7862fdc2fb8c303878843f5dd728191f7837cf8d0ed41f8e470b15181223a3a5131881add9c22b2453b01be4edef104"
|
||||
)
|
||||
|
@ -14,23 +14,15 @@
|
||||
# You should have received a copy of the License along with this library.
|
||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||
|
||||
from binascii import unhexlify
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import lisk, messages as proto
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from .common import TrezorTest
|
||||
from .conftest import TREZOR_VERSION
|
||||
|
||||
PUBLIC_KEY = unhexlify(
|
||||
"eb56d7bbb5e8ea9269405f7a8527fe126023d1db2c973cfac6f760b60ae27294"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.lisk
|
||||
@pytest.mark.xfail(TREZOR_VERSION == 1, reason="waiting for PR#351")
|
||||
class TestMsgLiskSignTx(TrezorTest):
|
||||
def test_lisk_sign_tx_send(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
@ -41,7 +33,7 @@ class TestMsgLiskSignTx(TrezorTest):
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
||||
proto.LiskSignedTx(
|
||||
signature=unhexlify(
|
||||
signature=bytes.fromhex(
|
||||
"b62717d581e5713bca60b758b661e6cfa091addc6caedd57534e06cda805943ee80797b9fb9a1e1b2bd584e292d2a7f832a4d1b3f15f00e1ee1b72de7e195a08"
|
||||
)
|
||||
),
|
||||
@ -70,7 +62,7 @@ class TestMsgLiskSignTx(TrezorTest):
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
||||
proto.LiskSignedTx(
|
||||
signature=unhexlify(
|
||||
signature=bytes.fromhex(
|
||||
"5dd0dbb87ee46f3e985b1ef2df85cb0bec481e8601d150388f73e198cdd57a698eab076c7cd5b281fbb6a83dd3dc64d91a6eccd1614dffd46f101194ffa3a004"
|
||||
)
|
||||
),
|
||||
@ -99,7 +91,7 @@ class TestMsgLiskSignTx(TrezorTest):
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.PublicKey),
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
||||
proto.LiskSignedTx(
|
||||
signature=unhexlify(
|
||||
signature=bytes.fromhex(
|
||||
"f02bdc40a7599c21d29db4080ff1ff8934f76eedf5b0c4fa695c8a64af2f0b40a5c4f92db203863eebbbfad8f0611a23f451ed8bb711490234cdfb034728fd01"
|
||||
)
|
||||
),
|
||||
@ -131,7 +123,7 @@ class TestMsgLiskSignTx(TrezorTest):
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
||||
proto.LiskSignedTx(
|
||||
signature=unhexlify(
|
||||
signature=bytes.fromhex(
|
||||
"5ac02b2882b9d7d0f944e48baadc27de1296cc08c3533f7c8e380fbbb9fb4a6ac81b5dc57060d7d8c68912eea24eb6e39024801bccc0d55020e2052b0c2bb701"
|
||||
)
|
||||
),
|
||||
@ -159,7 +151,7 @@ class TestMsgLiskSignTx(TrezorTest):
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
||||
proto.LiskSignedTx(
|
||||
signature=unhexlify(
|
||||
signature=bytes.fromhex(
|
||||
"1d0599a8387edaa4a6d309b8a78accd1ceaff20ff9d87136b01cba0efbcb9781c13dc2b0bab5a1ea4f196d8dcc9dbdbd2d56dbffcc088fc77686b2e2c2fe560f"
|
||||
)
|
||||
),
|
||||
@ -192,7 +184,7 @@ class TestMsgLiskSignTx(TrezorTest):
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
|
||||
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
|
||||
proto.LiskSignedTx(
|
||||
signature=unhexlify(
|
||||
signature=bytes.fromhex(
|
||||
"88923866c2d500a6927715699ab41a0f58ea4b52e552d90e923bc24ac9da240f2328c93f9ce043a1da4937d4b61c7f57c02fc931f9824d06b24731e7be23c506"
|
||||
)
|
||||
),
|
||||
|
@ -14,18 +14,14 @@
|
||||
# You should have received a copy of the License along with this library.
|
||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||
|
||||
from binascii import unhexlify
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import lisk, messages as proto
|
||||
|
||||
from .common import TrezorTest
|
||||
from .conftest import TREZOR_VERSION
|
||||
|
||||
|
||||
@pytest.mark.lisk
|
||||
@pytest.mark.xfail(TREZOR_VERSION == 1, reason="waiting for PR#351")
|
||||
class TestMsgLiskVerifymessage(TrezorTest):
|
||||
def test_verify(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
@ -39,10 +35,10 @@ class TestMsgLiskVerifymessage(TrezorTest):
|
||||
)
|
||||
lisk.verify_message(
|
||||
self.client,
|
||||
unhexlify(
|
||||
bytes.fromhex(
|
||||
"eb56d7bbb5e8ea9269405f7a8527fe126023d1db2c973cfac6f760b60ae27294"
|
||||
),
|
||||
unhexlify(
|
||||
bytes.fromhex(
|
||||
"7858ae7cd52ea6d4b17e800ca60144423db5560bfd618b663ffbf26ab66758563df45cbffae8463db22dc285dd94309083b8c807776085b97d05374d79867d05"
|
||||
),
|
||||
"This is an example of a signed message.",
|
||||
@ -60,10 +56,10 @@ class TestMsgLiskVerifymessage(TrezorTest):
|
||||
)
|
||||
lisk.verify_message(
|
||||
self.client,
|
||||
unhexlify(
|
||||
bytes.fromhex(
|
||||
"8bca6b65a1a877767b746ea0b3c4310d404aa113df99c1b554e1802d70185ab5"
|
||||
),
|
||||
unhexlify(
|
||||
bytes.fromhex(
|
||||
"458ca5896d0934866992268f7509b5e954d568b1251e20c19bd3149ee3c86ffb5a44d1c2a0abbb99a3ab4767272dbb0e419b4579e890a24919ebbbe6cc0f970f"
|
||||
),
|
||||
"VeryLongMessage!" * 64,
|
||||
|
Loading…
Reference in New Issue
Block a user