diff --git a/tests/integration/nano/nanos/test_nanos_regression_batched_ops.py b/tests/integration/nano/nanos/test_nanos_regression_batched_ops.py index 772c4dbba..3143e874a 100755 --- a/tests/integration/nano/nanos/test_nanos_regression_batched_ops.py +++ b/tests/integration/nano/nanos/test_nanos_regression_batched_ops.py @@ -20,20 +20,7 @@ from conftest import requires_device from utils.app import TezosAppScreen, DEFAULT_ACCOUNT -from utils.message import RawMessage - -# Operation (0): Transaction -# Fee: 0.39 XTZ -# Storage limit: 6 -# Amount: 0.02 XTZ -# Destination: tz1cfdVKpBb9VRBdny8BQ5RSK82UudAp2miM -# Entrypoint: jean_bob -# Parameter: {Pair {} (Right -76723569314251090535296646);Pair {Elt Unit (Pair {Left Unit} (Pair (Left 0x03F01167865DC63DFEE0E31251329CEAB660D94606) (Pair 0x0107B21FCA96C5763F67B286752C7AAEFC5931D15A Unit)))} (Right 3120123370638446806591421154959427514880865200209654970345);Pair {} (Left (Some Unit))} -# Operation (1): Transaction -# Fee: 0.65 XTZ -# Storage limit: 2 -# Amount: 0.06 XTZ -# Destination: KT1CYT8oACUcCSNTu2qfgB4fj5bD7szYrpti +from utils.message import OperationGroup, Transaction @requires_device("nanos") def test_nanos_regression_batched_ops(app: TezosAppScreen): @@ -42,7 +29,28 @@ def test_nanos_regression_batched_ops(app: TezosAppScreen): app.setup_expert_mode() - message = RawMessage("0300000000000000000000000000000000000000000000000000000000000000006c001597c45b11b421bb806a0c56c5da5638bf4b1adbf0e617090006a09c010000bac799dfc7f6af2ff0b95f83d023e68c895020baffff086a65616e5f626f620000009a020000009507070200000000050800c6bab5ccc8d891cd8de4b6f7070707020000004b0704030b070702000000040505030b070705050a0000001503f01167865dc63dfee0e31251329ceab660d9460607070a000000150107b21fca96c5763f67b286752c7aaefc5931d15a030b050800a9df9fc1e7eaa7a9c1f7bd87a9ba9cadf5b5b2cd829deea2b7fef9070707020000000005050509030b6c01ee572f02e5be5d097ba17369789582882e8abb8790d627063202e0d403012b704944f5b5fd30eed2ab4385478488e09fe04a0000") + message = OperationGroup([ + Transaction( + source = 'tz1McCh72NRhYmJBcWr3zDrLJAxnfR9swcFh', + fee = 390000, + counter = 9, + gas_limit = 0, + storage_limit = 6, + destination = 'tz1cfdVKpBb9VRBdny8BQ5RSK82UudAp2miM', + amount = 20000, + entrypoint = 'jean_bob', + parameter = [{'prim':'Pair','args':[[],{'prim':'Right','args':[{'int':-76723569314251090535296646}]}]},{'prim':'Pair','args':[[{'prim':'Elt','args':[{'prim':'Unit','args':[]},{'prim':'Pair','args':[[{'prim':'Left','args':[{'prim':'Unit','args':[]}]}],{'prim':'Pair','args':[{'prim':'Left','args':[{'bytes':"03F01167865DC63DFEE0E31251329CEAB660D94606"}]},{'prim':'Pair','args':[{'bytes':"0107B21FCA96C5763F67B286752C7AAEFC5931D15A"},{'prim':'Unit','args':[]}]}]}]}]}],{'prim':'Right','args':[{'int':3120123370638446806591421154959427514880865200209654970345}]},]},{'prim':'Pair','args':[[],{'prim':'Left','args':[{'prim':'Some','args':[{'prim':'Unit','args':[]}]}]}]}] + ), + Transaction( + source = 'tz2W3Tvcm64GjcV2bipUynnEsctLFz5Z6yRa', + fee = 650000, + counter = 6, + gas_limit = 50, + storage_limit = 2, + destination = 'KT1CYT8oACUcCSNTu2qfgB4fj5bD7szYrpti', + amount = 60000 + ) + ]) data = app.sign(DEFAULT_ACCOUNT, message, diff --git a/tests/integration/nano/nanox/test_nanox_regression_batched_ops.py b/tests/integration/nano/nanox/test_nanox_regression_batched_ops.py index 2af3a56cf..4c54f0684 100755 --- a/tests/integration/nano/nanox/test_nanox_regression_batched_ops.py +++ b/tests/integration/nano/nanox/test_nanox_regression_batched_ops.py @@ -20,20 +20,7 @@ from conftest import requires_device from utils.app import TezosAppScreen, DEFAULT_ACCOUNT -from utils.message import RawMessage - -# Operation (0): Transaction -# Fee: 0.39 XTZ -# Storage limit: 6 -# Amount: 0.02 XTZ -# Destination: tz1cfdVKpBb9VRBdny8BQ5RSK82UudAp2miM -# Entrypoint: jean_bob -# Parameter: {Pair {} (Right -76723569314251090535296646);Pair {Elt Unit (Pair {Left Unit} (Pair (Left 0x03F01167865DC63DFEE0E31251329CEAB660D94606) (Pair 0x0107B21FCA96C5763F67B286752C7AAEFC5931D15A Unit)))} (Right 3120123370638446806591421154959427514880865200209654970345);Pair {} (Left (Some Unit))} -# Operation (1): Transaction -# Fee: 0.65 XTZ -# Storage limit: 2 -# Amount: 0.06 XTZ -# Destination: KT1CYT8oACUcCSNTu2qfgB4fj5bD7szYrpti +from utils.message import OperationGroup, Transaction @requires_device("nanox") def test_nanox_regression_batched_ops(app: TezosAppScreen): @@ -42,7 +29,28 @@ def test_nanox_regression_batched_ops(app: TezosAppScreen): app.setup_expert_mode() - message = RawMessage("0300000000000000000000000000000000000000000000000000000000000000006c001597c45b11b421bb806a0c56c5da5638bf4b1adbf0e617090006a09c010000bac799dfc7f6af2ff0b95f83d023e68c895020baffff086a65616e5f626f620000009a020000009507070200000000050800c6bab5ccc8d891cd8de4b6f7070707020000004b0704030b070702000000040505030b070705050a0000001503f01167865dc63dfee0e31251329ceab660d9460607070a000000150107b21fca96c5763f67b286752c7aaefc5931d15a030b050800a9df9fc1e7eaa7a9c1f7bd87a9ba9cadf5b5b2cd829deea2b7fef9070707020000000005050509030b6c01ee572f02e5be5d097ba17369789582882e8abb8790d627063202e0d403012b704944f5b5fd30eed2ab4385478488e09fe04a0000") + message = OperationGroup([ + Transaction( + source = 'tz1McCh72NRhYmJBcWr3zDrLJAxnfR9swcFh', + fee = 390000, + counter = 9, + gas_limit = 0, + storage_limit = 6, + destination = 'tz1cfdVKpBb9VRBdny8BQ5RSK82UudAp2miM', + amount = 20000, + entrypoint = 'jean_bob', + parameter = [{'prim':'Pair','args':[[],{'prim':'Right','args':[{'int':-76723569314251090535296646}]}]},{'prim':'Pair','args':[[{'prim':'Elt','args':[{'prim':'Unit','args':[]},{'prim':'Pair','args':[[{'prim':'Left','args':[{'prim':'Unit','args':[]}]}],{'prim':'Pair','args':[{'prim':'Left','args':[{'bytes':"03F01167865DC63DFEE0E31251329CEAB660D94606"}]},{'prim':'Pair','args':[{'bytes':"0107B21FCA96C5763F67B286752C7AAEFC5931D15A"},{'prim':'Unit','args':[]}]}]}]}]}],{'prim':'Right','args':[{'int':3120123370638446806591421154959427514880865200209654970345}]},]},{'prim':'Pair','args':[[],{'prim':'Left','args':[{'prim':'Some','args':[{'prim':'Unit','args':[]}]}]}]}] + ), + Transaction( + source = 'tz2W3Tvcm64GjcV2bipUynnEsctLFz5Z6yRa', + fee = 650000, + counter = 6, + gas_limit = 50, + storage_limit = 2, + destination = 'KT1CYT8oACUcCSNTu2qfgB4fj5bD7szYrpti', + amount = 60000 + ) + ]) data = app.sign(DEFAULT_ACCOUNT, message, diff --git a/tests/integration/nano/test_sign_complex_operation.py b/tests/integration/nano/test_sign_complex_operation.py index c2b6ec17c..0ccf3ddf5 100644 --- a/tests/integration/nano/test_sign_complex_operation.py +++ b/tests/integration/nano/test_sign_complex_operation.py @@ -18,34 +18,11 @@ from pathlib import Path from utils.app import Screen, TezosAppScreen, DEFAULT_ACCOUNT -from utils.message import RawMessage - -# Operation (0): Transaction -# Fee: 0.05 XTZ -# Storage limit: 45 -# Amount: 0.24 XTZ -# Destination: KT18amZmM5W7qDWVt2pH6uj7sCEd3kbzLrHT -# Entrypoint: do -# Parameter: CAR - -## Operation (0): Origination -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 0.5 XTZ -# Storage limit: 4 -# Balance: 1 XTZ -# Delegate: None -# Code: UNPACK mutez -# Storage: or key chest -## Operation (1): Transfer ticket -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 0.01 XTZ -# Storage limit: 5 -# Contents: None -# Type: option nat -# Ticketer: tz1TmFPVZsGQ8MnrBJtnECJgkFUwLa6EWYDm -# Amount: 7 -# Destination: tz3eydffbLkjdVb8zx42BvxpGV87zaRnqL3r -# Entrypoint: default +from utils.message import ( + OperationGroup, + Origination, + TransferTicket +) def test_sign_complex_operation(app: TezosAppScreen): """Check signing complex operation""" @@ -54,7 +31,30 @@ def test_sign_complex_operation(app: TezosAppScreen): app.assert_screen(Screen.HOME) app.setup_expert_mode() - message = RawMessage("0300000000000000000000000000000000000000000000000000000000000000006d00ffdd6102321bc251e4a5190ad5b12b251069d9b4a0c21e040304c0843d0000000004050d036a000000060764035c038d9e00ffdd6102321bc251e4a5190ad5b12b251069d9b4904e05040500000002030600000004056303620000591e842444265757d6a65e3670ca18b5e662f9c0070002cc8e146741cf31fc00123b8c26baf95c57421a3c0000000764656661756c74") + message = OperationGroup([ + Origination( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 500000, + counter = 4, + gas_limit = 3, + storage_limit = 4, + code = {'prim': 'UNPACK', 'args': [{'prim': 'mutez'}]}, + storage = {'prim': 'or', 'args': [{'prim': 'key'}, {'prim': 'chest'}]}, + balance = 1000000 + ), + TransferTicket( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 10000, + counter = 5, + gas_limit = 4, + storage_limit = 5, + ticket_contents = {'prim': 'None'}, + ticket_ty = {'prim': 'option', 'args': [{'prim': 'nat'}]}, + ticket_ticketer = 'tz1TmFPVZsGQ8MnrBJtnECJgkFUwLa6EWYDm', + ticket_amount = 7, + destination = 'tz3eydffbLkjdVb8zx42BvxpGV87zaRnqL3r' + ) + ]) data = app.sign(DEFAULT_ACCOUNT, message, diff --git a/tests/integration/nano/test_sign_too_long_operation.py b/tests/integration/nano/test_sign_too_long_operation.py index 5385d688b..a884081ce 100644 --- a/tests/integration/nano/test_sign_too_long_operation.py +++ b/tests/integration/nano/test_sign_too_long_operation.py @@ -20,20 +20,27 @@ from utils.app import ScreenText, TezosAppScreen, DEFAULT_ACCOUNT from utils.backend import StatusCode -from utils.message import RawMessage +from utils.message import ( + Message, + Proposals, + OperationGroup, + Reveal, + Transaction, + Delegation, + RegisterGlobalConstant, + SetDepositLimit, + ScRollupAddMessage +) test_path = Path(Path(__file__).stem) def _sign_too_long(app: TezosAppScreen, - msg: str, + message: Message, navigate: Callable[[], None]): - """Sign a too long message""" app.setup_expert_mode() app.setup_blindsign_on() - message = RawMessage(msg) - data = app._sign( DEFAULT_ACCOUNT, message, @@ -48,18 +55,20 @@ def _sign_too_long(app: TezosAppScreen, app.quit() -def _sign_decodable_too_long(app, msg: str, path: Path): +def _sign_decodable_too_long(app: TezosAppScreen, + message: Message, + path: Path): """Sign a decodable too long message""" def navigate() -> None: app.navigate_until_text(ScreenText.ACCEPT_RISK, path / "clear_n_too_long_warning") app.navigate_until_text(ScreenText.SIGN_ACCEPT, path / "summary") - _sign_too_long(app, msg, navigate) + _sign_too_long(app, message, navigate) def _reject_too_long( app, - msg: str, + message: Message, status_code: StatusCode, navigate: Callable[[], None]): """Reject a too long message""" @@ -67,8 +76,6 @@ def _reject_too_long( app.setup_expert_mode() app.setup_blindsign_on() - message = RawMessage(msg) - app._failing_signing( DEFAULT_ACCOUNT, message, @@ -83,54 +90,72 @@ def _reject_too_long( basic_test_path = test_path / "basic" -## Operation (0): Reveal -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 1 XTZ -# Storage limit: 4 -# Public key: p2pk66m3NQsd4n6LJWe9WMwx9WHeXwKmBaMwXX92WkMQCR99zmwk2PM -## Operation (1): Transaction -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 2 XTZ -# Storage limit: 7 -# Amount: 3 XTZ -# Destination: tz3XMQscBFM9vPmpbYMavMmwxRMUWvWGZMQQ -# Entrypoint: update_config -# Parameter: Pair 5 True -## Operation (2): Delegation -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 3 XTZ -# Storage limit: 5 -# Delegate: tz2W3Tvcm64GjcV2bipUynnEsctLFz5Z6yRa -## Operation (3): SR: send messages -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 4 XTZ -# Storage limit: 6 -# Message (0): 6d65737361676530 -# Message (1): 6d65737361676531 -# Message (2): 6d65737361676532 -# Message (3): 6d65737361676533 -# Message (4): 6d65737361676534 -# Message (5): 6d65737361676535 -# Message (6): 6d65737361676536 -# Message (7): 6d65737361676537 -# Message (8): 6d65737361676538 -# Message (9): 6d65737361676539 -# Message (10): 6d6573736167653130 -# Message (11): 6d6573736167653131 -# Message (12): 6d6573736167653132 -# Message (13): 6d6573736167653133 -# Message (14): 6d6573736167653134 -# Message (15): 6d6573736167653135 -# Message (16): 6d6573736167653136 -# Message (17): 6d6573736167653137 -# Message (18): 6d6573736167653138 -# Message (19): 6d6573736167653139 -## Operation (4): Set deposit limit -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 1 XTZ -# Storage limit: 3 -# Staking limit: 10 XTZ -BASIC_OPERATION = "0300000000000000000000000000000000000000000000000000000000000000006b00ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0b0104020320182716513907b6bab33f905396d031931c07e01bddd780780c1a56b9c086da6c00ffdd6102321bc251e4a5190ad5b12b251069d9b480897a0c0107c08db701000278eb8b6ab9a768579cd5146b480789650c83f28effff0d7570646174655f636f6e6669670000000607070005030a6e00ffdd6102321bc251e4a5190ad5b12b251069d9b4c08db7010d0105ff01ee572f02e5be5d097ba17369789582882e8abb87c900ffdd6102321bc251e4a5190ad5b12b251069d9b48092f4010e0106000000fa000000086d65737361676530000000086d65737361676531000000086d65737361676532000000086d65737361676533000000086d65737361676534000000086d65737361676535000000086d65737361676536000000086d65737361676537000000086d65737361676538000000086d65737361676539000000096d6573736167653130000000096d6573736167653131000000096d6573736167653132000000096d6573736167653133000000096d6573736167653134000000096d6573736167653135000000096d6573736167653136000000096d6573736167653137000000096d6573736167653138000000096d65737361676531397000ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0f0103ff80ade204" +BASIC_OPERATION = OperationGroup([ + Reveal( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 1000000, + counter = 11, + gas_limit = 1, + storage_limit = 4, + public_key = 'p2pk66m3NQsd4n6LJWe9WMwx9WHeXwKmBaMwXX92WkMQCR99zmwk2PM' + ), + Transaction( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 2000000, + counter = 12, + gas_limit = 1, + storage_limit = 7, + destination = 'tz3XMQscBFM9vPmpbYMavMmwxRMUWvWGZMQQ', + amount = 3000000, + entrypoint = 'update_config', + parameter = {'prim': 'Pair', 'args': [ {'int': 5}, {'prim': 'True'} ]} + ), + Delegation( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 3000000, + counter = 13, + gas_limit = 1, + storage_limit = 5, + delegate = 'tz2W3Tvcm64GjcV2bipUynnEsctLFz5Z6yRa' + ), + ScRollupAddMessage( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 4000000, + counter = 14, + gas_limit = 1, + storage_limit = 6, + message = [ + bytes.fromhex('6d65737361676530'), + bytes.fromhex('6d65737361676531'), + bytes.fromhex('6d65737361676532'), + bytes.fromhex('6d65737361676533'), + bytes.fromhex('6d65737361676534'), + bytes.fromhex('6d65737361676535'), + bytes.fromhex('6d65737361676536'), + bytes.fromhex('6d65737361676537'), + bytes.fromhex('6d65737361676538'), + bytes.fromhex('6d65737361676539'), + bytes.fromhex('6d6573736167653130'), + bytes.fromhex('6d6573736167653131'), + bytes.fromhex('6d6573736167653132'), + bytes.fromhex('6d6573736167653133'), + bytes.fromhex('6d6573736167653134'), + bytes.fromhex('6d6573736167653135'), + bytes.fromhex('6d6573736167653136'), + bytes.fromhex('6d6573736167653137'), + bytes.fromhex('6d6573736167653138'), + bytes.fromhex('6d6573736167653139') + ] + ), + SetDepositLimit( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 1000000, + counter = 15, + gas_limit = 1, + storage_limit = 3, + limit = 10000000 + ) +]) def test_sign_basic_too_long_operation(app: TezosAppScreen): """Check sign too long operation""" @@ -158,120 +183,150 @@ def navigate() -> None: ### Different kind of too long operation ### -## Operation (0): Transaction -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 0 XTZ -# Storage limit: 0 -# Amount: 10 XTZ -# Destination: tz1er74kx433vTtpYddGsf3dDt5piBZeeHyQ -## Operation (1): Transaction -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 1 XTZ -# Storage limit: 1 -# Amount: 1 XTZ -# Destination: tz2PPZ2WN4j92Rdx4NM7oW3HAp3x825HUyac -## Operation (2): Transaction -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 2 XTZ -# Storage limit: 2 -# Amount: 2 XTZ -# Destination: tz1Kp8NCAN5WWwvkWkMmQQXMRe68iURmoQ8w -## Operation (3): Transaction -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 3 XTZ -# Storage limit: 3 -# Amount: 3 XTZ -# Destination: tz3fLwHKthqhTPK6Lar6CTXN1WbDETw1YpGB -## Operation (4): Transaction -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 4 XTZ -# Storage limit: 4 -# Amount: 4 XTZ -# Destination: tz3eydffbLkjdVb8zx42BvxpGV87zaRnqL3r -## Operation (5): Transaction -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 5 XTZ -# Storage limit: 5 -# Amount: 5 XTZ -# Destination: tz2JPgTWZZpxZZLqHMfS69UAy1UHm4Aw5iHu def test_sign_too_long_operation_with_only_transactions(app: TezosAppScreen): """Check sign too long operation that contains only transaction""" - msg="0300000000000000000000000000000000000000000000000000000000000000006c00ffdd6102321bc251e4a5190ad5b12b251069d9b4000b010080ade2040000d2b3082b0fe03f0f7f39915cdba50e9d9b8ab057006c00ffdd6102321bc251e4a5190ad5b12b251069d9b4c0843d0c0101c0843d0001a55ae1858c1201514c97aa9122e77d3c4197a714006c00ffdd6102321bc251e4a5190ad5b12b251069d9b480897a0d010280897a000001e8e5519a315280a374c8765107979a6049de27006c00ffdd6102321bc251e4a5190ad5b12b251069d9b4c08db7010e0103c08db7010002d09584de879c4bbd3f494ed01b82e06a81e8e176006c00ffdd6102321bc251e4a5190ad5b12b251069d9b48092f4010f01048092f4010002cc8e146741cf31fc00123b8c26baf95c57421a3c006c00ffdd6102321bc251e4a5190ad5b12b251069d9b4c096b102100105c096b10200016e8874874d31c3fbd636e924d5a036a43ec8faa700" - _sign_decodable_too_long(app, msg, test_path / "only_transactions") - -## Operation (0): Proposals -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Period: 32 -# Proposal (0): ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp -# Proposal (1): ProtoGenesisGenesisGenesisGenesisGenesisGenesk612im -# Proposal (2): PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i -# Proposal (3): Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P -# Proposal (4): PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS -# Proposal (5): PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb -# Proposal (6): PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo -# Proposal (7): PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA -# Proposal (8): PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i -# Proposal (9): PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV -# Proposal (10): PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx -# Proposal (11): Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A -# Proposal (12): PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY -# Proposal (13): PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg -# Proposal (14): PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW -# Proposal (15): PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1 -# Proposal (16): PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf -# Proposal (17): ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH -# Proposal (18): PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ -# Proposal (19): ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK + message = OperationGroup([ + Transaction( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 0, + counter = 11, + gas_limit = 1, + storage_limit = 0, + destination = 'tz1er74kx433vTtpYddGsf3dDt5piBZeeHyQ', + amount = 10000000 + ), + Transaction( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 1000000, + counter = 12, + gas_limit = 1, + storage_limit = 1, + destination = 'tz2PPZ2WN4j92Rdx4NM7oW3HAp3x825HUyac', + amount = 1000000 + ), + Transaction( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 2000000, + counter = 13, + gas_limit = 1, + storage_limit = 2, + destination = 'tz1Kp8NCAN5WWwvkWkMmQQXMRe68iURmoQ8w', + amount = 2000000 + ), + Transaction( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 3000000, + counter = 14, + gas_limit = 1, + storage_limit = 3, + destination = 'tz3fLwHKthqhTPK6Lar6CTXN1WbDETw1YpGB', + amount = 3000000 + ), + Transaction( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 4000000, + counter = 15, + gas_limit = 1, + storage_limit = 4, + destination = 'tz3eydffbLkjdVb8zx42BvxpGV87zaRnqL3r', + amount = 4000000 + ), + Transaction( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 5000000, + counter = 16, + gas_limit = 1, + storage_limit = 5, + destination = 'tz2JPgTWZZpxZZLqHMfS69UAy1UHm4Aw5iHu', + amount = 5000000 + ) + ]) + _sign_decodable_too_long(app, message, test_path / "only_transactions") + def test_sign_too_long_operation_without_fee_or_amount(app: TezosAppScreen): """Check sign too long operation that doesn't have fees or amount""" - msg="0300000000000000000000000000000000000000000000000000000000000000000500ffdd6102321bc251e4a5190ad5b12b251069d9b400000020000002800bcd7db2d718ba94e85bd262681049852e1f58512aa552124330d657845c73b70bcd7ffca03f57e38453f0d3e84c302403c05357448b4c2daef8b3a8be3c69c1000000000000000000000000000000000000000000000000000000000000000038ecdef0cd08640f318a9b055f6b0d0c9ae030913a871d9b9d86fb846317da213d0b4bacb5c3e152a167da26fefc266bd3a0e14fc4e41e6c53623bf482833da23e5e3a606afab74a59ca09e333633e2770b6492c5e594455b71e9a2f0ea92afb40cab83d3f37a64da26b57ad3d0432ae881293a25169ada387bfc74a1cbf9e6ec7ad4f7a000e28e9eefc58de8ea1172de843242bd2e688779953d3416a44640b4596285c6871691e25196c6a8d26d90a3ac91375731e3926103c517a13a0ba56cbb944f74244ea2681981f25995f8ebba8ff6cee8c036892fe901cb760c4e39ece5f061e34b5a21feab8dbdfe755ef17e70c9f565464f067ac5e7c02be830a488424520cf9bbf0a42770204d95dcc1f11e404fdb3e90c84850c4cfdb50c5c4b9d0a3f07b8adfcf61f5ca60f244ca9a876e76cbad9140980f6c88d0bf900ac6d8d2ea9f23a1a1011091841b12e32ce2f8c3facff27feee58bb7c9e90567d11425d57ed88be5a69815e39386a33f7dcad391f5f507e03b376e499272c86c6cf2a7d8325f11da2ff36934a586439f085655a833f2ff6a12d15e83b951fb684326e0d9b8c2314cc05ffa3fc655a98bb87155be4cf7ce67fee6b594ea9302e8655df20bf44c7d64e3d7da27d925d10af535fb36cef0ad41930c7929773f4731eba137dbff6586a04802d3f513c65a444d9d4debe42b17e9e7273f8f6c118ea3f4e06e0bcd7b2cadcd87ecb0d5c50330fb59feed7432bffecede8a09a2b86d1527c6a5" - _sign_decodable_too_long(app, msg, test_path / "without_fee_or_amount") + message = Proposals( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + proposals = [ + 'ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp', + 'ProtoGenesisGenesisGenesisGenesisGenesisGenesk612im', + 'PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i', + 'Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P', + 'PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS', + 'PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb', + 'PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo', + 'PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA', + 'PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i', + 'PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV', + 'PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx', + 'Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A', + 'PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY', + 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg', + 'PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW', + 'PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1', + 'PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf', + 'ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH', + 'PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ', + 'ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK' + ], + period = 32 + ) + _sign_decodable_too_long(app, message, test_path / "without_fee_or_amount") ### Too long operation containing a too large number ### too_large_test_path = test_path / "too_large" -# Operation (0): SR: send messages -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 4 XTZ -# Storage limit: 6 -# Message (0): 6d65737361676530 -# Message (1): 6d65737361676531 -# Message (2): 6d65737361676532 -# Message (3): 6d65737361676533 -# Message (4): 6d65737361676534 -# Message (5): 6d65737361676535 -# Message (6): 6d65737361676536 -# Message (7): 6d65737361676537 -# Message (8): 6d65737361676538 -# Message (9): 6d65737361676539 -# Message (10): 6d6573736167653130 -# Message (11): 6d6573736167653131 -# Message (12): 6d6573736167653132 -# Message (13): 6d6573736167653133 -# Message (14): 6d6573736167653134 -# Message (15): 6d6573736167653135 -# Message (16): 6d6573736167653136 -# Message (17): 6d6573736167653137 -# Message (18): 6d6573736167653138 -# Message (19): 6d6573736167653139 -# Message (20): 6d6573736167653230 -# Message (21): 6d6573736167653231 -# Message (22): 6d6573736167653232 -# Message (23): 6d6573736167653233 -# Message (24): 6d6573736167653234 -# Message (25): 6d6573736167653235 -# Message (26): 6d6573736167653236 -# Message (27): 6d6573736167653237 -# Message (28): 6d6573736167653238 -# Message (29): 6d6573736167653239 -## Operation (1): Register global constant -# Source: tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa -# Fee: 5 XTZ -# Storage limit: 3 -# Value: 115792089237316195423570985008687907853269984665640564039457584007913129639936 -OPERATION_WITH_TOO_LARGE = "030000000000000000000000000000000000000000000000000000000000000000c900ffdd6102321bc251e4a5190ad5b12b251069d9b48092f4010b01060000017c000000086d65737361676530000000086d65737361676531000000086d65737361676532000000086d65737361676533000000086d65737361676534000000086d65737361676535000000086d65737361676536000000086d65737361676537000000086d65737361676538000000086d65737361676539000000096d6573736167653130000000096d6573736167653131000000096d6573736167653132000000096d6573736167653133000000096d6573736167653134000000096d6573736167653135000000096d6573736167653136000000096d6573736167653137000000096d6573736167653138000000096d6573736167653139000000096d6573736167653230000000096d6573736167653231000000096d6573736167653232000000096d6573736167653233000000096d6573736167653234000000096d6573736167653235000000096d6573736167653236000000096d6573736167653237000000096d6573736167653238000000096d65737361676532396f00ffdd6102321bc251e4a5190ad5b12b251069d9b4c096b1020c0103000000260080808080808080808080808080808080808080808080808080808080808080808080808020" +OPERATION_WITH_TOO_LARGE = OperationGroup([ + ScRollupAddMessage( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 4000000, + counter = 11, + gas_limit = 1, + storage_limit = 6, + message = [ + bytes.fromhex('6d65737361676530'), + bytes.fromhex('6d65737361676531'), + bytes.fromhex('6d65737361676532'), + bytes.fromhex('6d65737361676533'), + bytes.fromhex('6d65737361676534'), + bytes.fromhex('6d65737361676535'), + bytes.fromhex('6d65737361676536'), + bytes.fromhex('6d65737361676537'), + bytes.fromhex('6d65737361676538'), + bytes.fromhex('6d65737361676539'), + bytes.fromhex('6d6573736167653130'), + bytes.fromhex('6d6573736167653131'), + bytes.fromhex('6d6573736167653132'), + bytes.fromhex('6d6573736167653133'), + bytes.fromhex('6d6573736167653134'), + bytes.fromhex('6d6573736167653135'), + bytes.fromhex('6d6573736167653136'), + bytes.fromhex('6d6573736167653137'), + bytes.fromhex('6d6573736167653138'), + bytes.fromhex('6d6573736167653139'), + bytes.fromhex('6d6573736167653230'), + bytes.fromhex('6d6573736167653231'), + bytes.fromhex('6d6573736167653232'), + bytes.fromhex('6d6573736167653233'), + bytes.fromhex('6d6573736167653234'), + bytes.fromhex('6d6573736167653235'), + bytes.fromhex('6d6573736167653236'), + bytes.fromhex('6d6573736167653237'), + bytes.fromhex('6d6573736167653238'), + bytes.fromhex('6d6573736167653239') + ] + ), + RegisterGlobalConstant( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 5000000, + counter = 12, + gas_limit = 1, + storage_limit = 3, + value = {'int': 115792089237316195423570985008687907853269984665640564039457584007913129639936} + ) +]) def test_sign_too_long_operation_with_too_large(app: TezosAppScreen): """Check sign too long operation that will also fail the parsing""" diff --git a/tests/integration/nano/utils/message.py b/tests/integration/nano/utils/message.py index 1c1ada532..19b60a2f5 100644 --- a/tests/integration/nano/utils/message.py +++ b/tests/integration/nano/utils/message.py @@ -421,6 +421,20 @@ def __init__(self, self.storage_limit = storage_limit Operation.__init__(self, **kwargs) +class OperationGroup(Operation): + """Class representing a group of tezos manager operation.""" + + operations: List[ManagerOperation] + + def __init__(self, + operations: List[ManagerOperation] = [], + **kwargs): + self.operations = operations + Operation.__init__(self, **kwargs) + + def forge(self) -> bytes: + return b''.join(map(lambda op: op.forge(), self.operations)) + class Reveal(ManagerOperation): """Class representing a tezos reveal."""