From b04edf190aee21f0e1c984be3a7df82b3e349e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Palmer?= Date: Wed, 11 Oct 2023 08:58:48 +0200 Subject: [PATCH] Tests: add a tests for the SIGN instruction for the Stax device --- .../stax/test_sign_transfer_without_hash.py | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tests/integration/stax/test_sign_transfer_without_hash.py diff --git a/tests/integration/stax/test_sign_transfer_without_hash.py b/tests/integration/stax/test_sign_transfer_without_hash.py new file mode 100644 index 000000000..c597ad58d --- /dev/null +++ b/tests/integration/stax/test_sign_transfer_without_hash.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +# Copyright 2023 Functori + +# 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. + +from utils import * + +# full input: 0300000000000000000000000000000000000000000000000000000000000000006c016e8874874d31c3fbd636e924d5a036a43ec8faa7d0860308362d80d30e01000000000000000000000000000000000000000000ff02000000020316 +# full output: CAR +# signer: tz1dyX3B1CFYa2DfdFLyPtiJCfQRUgPVME6E +# path: m/44'/1729'/0'/0' + +if __name__ == "__main__": + app = stax_app() + + app.assert_screen(SCREEN_HOME_DEFAULT) + + app.send_apdu("8004000011048000002c800006c18000000080000000"); + app.expect_apdu_return("9000"); + + app.assert_screen("review_request_sign_operation"); + + app.send_apdu("800481005e0300000000000000000000000000000000000000000000000000000000000000006c016e8874874d31c3fbd636e924d5a036a43ec8faa7d0860308362d80d30e01000000000000000000000000000000000000000000ff02000000020316"); + + app.review.tap() + app.assert_screen("operation_0_transaction") + + app.review.tap() + app.assert_screen("operation_fee_0.05") + + app.review.tap() + app.assert_screen("operation_storage_limit_45") + + app.review.tap() + app.assert_screen("operation_amount_0.24tz") + + app.review.tap() + app.assert_screen("operation_destination_kt18am...rHT"); + + app.review.tap() + app.assert_screen("operation_entrypoint_do") + + app.review.tap() + app.assert_screen("operation_parameter_CAR") + + app.review.tap() + app.assert_screen("operation_sign") + + expected_apdu = "f63d045a1cc9f73eee5775c5d496fa9d3aa9ae57fb97217f746a8728639795b7b2220e84ce5759ed111399ea3263d810c230d6a4fffcb6e82797c5ca673a17089000" + app.review_confirm_signing(expected_apdu) + + app.assert_screen(SCREEN_HOME_DEFAULT) + app.welcome.quit()