Skip to content

Commit

Permalink
[test] gathering batched operations tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spalmer25 committed Dec 9, 2024
1 parent 2a2a9e3 commit 444be4c
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 205 deletions.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ integration_tests_basic_flex: app_flex.tgz \

integration_tests_basic_%: app_%.tgz \
app_%_dbg.tgz \
tests/integration/* \
tests/integration/nano/* \
tests/integration/nano/%/*
$(shell find tests/integration/nano -type f)
docker run --rm -i -v "$(realpath .):/app" \
--entrypoint=/bin/sh ledger-app-tezos-integration-tests -c " \
TMP_DIR=\$$(mktemp -d /tmp/foo-XXXXXX); \
Expand Down
Empty file.
66 changes: 0 additions & 66 deletions tests/integration/nano/nanos/test_nanos_regression_batched_ops.py

This file was deleted.

Empty file.
66 changes: 0 additions & 66 deletions tests/integration/nano/nanox/test_nanox_regression_batched_ops.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
#!/usr/bin/env python3
# Copyright 2024 Functori <[email protected]>
# Copyright 2024 Trilitech <[email protected]>

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Gathering of tests related to Batched operations."""

from conftest import requires_device

from utils.app import Screen, TezosAppScreen, DEFAULT_ACCOUNT
from utils.message import (
OperationGroup,
Origination,
Transaction,
TransferTicket
)

@requires_device("nanos")
def test_nanos_regression_batched_ops(app: TezosAppScreen):
"""Check signing batch operation"""
test_name = "test_nanos_regression_batched_ops"

app.setup_expert_mode()

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,
with_hash=True,
path=test_name)

app.checker.check_signature(
account=DEFAULT_ACCOUNT,
message=message,
with_hash=True,
data=data)

app.quit()

@requires_device("nanox")
def test_nanox_regression_batched_ops(app: TezosAppScreen):
"""Check signing batch operation"""
test_name = "test_nanox_regression_batched_ops"

app.setup_expert_mode()

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,
with_hash=True,
path=test_name)

app.checker.check_signature(
account=DEFAULT_ACCOUNT,
message=message,
with_hash=True,
data=data)

app.quit()

def test_sign_complex_operation(app: TezosAppScreen):
"""Check signing complex operation"""
test_name = "test_sign_complex_operation"

app.assert_screen(Screen.HOME)
app.setup_expert_mode()

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,
with_hash=True,
path=test_name)

app.checker.check_signature(
account=DEFAULT_ACCOUNT,
message=message,
with_hash=True,
data=data)

app.quit()
70 changes: 0 additions & 70 deletions tests/integration/nano/test_sign_complex_operation.py

This file was deleted.

0 comments on commit 444be4c

Please sign in to comment.