Skip to content

Commit

Permalink
[test] build operations group
Browse files Browse the repository at this point in the history
  • Loading branch information
spalmer25 committed Dec 12, 2024
1 parent 0c4d8e6 commit cae92c0
Show file tree
Hide file tree
Showing 5 changed files with 306 additions and 221 deletions.
38 changes: 23 additions & 15 deletions tests/integration/nano/nanos/test_nanos_regression_batched_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
Expand Down
38 changes: 23 additions & 15 deletions tests/integration/nano/nanox/test_nanox_regression_batched_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
Expand Down
58 changes: 29 additions & 29 deletions tests/integration/nano/test_sign_complex_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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,
Expand Down
Loading

0 comments on commit cae92c0

Please sign in to comment.