diff --git a/app/src/ui_stream_nbgl.c b/app/src/ui_stream_nbgl.c index 219635b4a..40d271838 100644 --- a/app/src/ui_stream_nbgl.c +++ b/app/src/ui_stream_nbgl.c @@ -47,13 +47,27 @@ tz_reject_ui(void) nbgl_useCaseStatus("Rejected", false, tz_reject); } +void +tz_accept_cb(void) +{ + tz_ui_stream_t *s = &global.stream; + + FUNC_ENTER(("void")); + + global.apdu.sign.step = SIGN_ST_WAIT_USER_INPUT; + s->cb(TZ_UI_STREAM_CB_ACCEPT); + ui_home_init(); + + FUNC_LEAVE(); +} + void tz_choice_ui(bool accept) { FUNC_ENTER(("accept=%d", accept)); if (accept) { - // FIXME: implement accept workflow + nbgl_useCaseStatus("SIGNING\nSUCCESSFUL", true, tz_accept_cb); } else { tz_reject_ui(); } diff --git a/tests/integration/stax/snapshots/operation_0_sr_outbox.png b/tests/integration/stax/snapshots/operation_0_sr_outbox.png new file mode 100644 index 000000000..97fb76a5f Binary files /dev/null and b/tests/integration/stax/snapshots/operation_0_sr_outbox.png differ diff --git a/tests/integration/stax/snapshots/operation_amount_0.24tz.png b/tests/integration/stax/snapshots/operation_amount_0.24tz.png new file mode 100644 index 000000000..e7ce83722 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_amount_0.24tz.png differ diff --git a/tests/integration/stax/snapshots/operation_commitment_src12UJ...LY8.png b/tests/integration/stax/snapshots/operation_commitment_src12UJ...LY8.png new file mode 100644 index 000000000..d5eae6682 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_commitment_src12UJ...LY8.png differ diff --git a/tests/integration/stax/snapshots/operation_destination_kt18am...rHT.png b/tests/integration/stax/snapshots/operation_destination_kt18am...rHT.png new file mode 100644 index 000000000..811a78caf Binary files /dev/null and b/tests/integration/stax/snapshots/operation_destination_kt18am...rHT.png differ diff --git a/tests/integration/stax/snapshots/operation_entrypoint_do.png b/tests/integration/stax/snapshots/operation_entrypoint_do.png new file mode 100644 index 000000000..bb304d403 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_entrypoint_do.png differ diff --git a/tests/integration/stax/snapshots/operation_fee_0.01.png b/tests/integration/stax/snapshots/operation_fee_0.01.png new file mode 100644 index 000000000..b14c74a35 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_fee_0.01.png differ diff --git a/tests/integration/stax/snapshots/operation_fee_0.05.png b/tests/integration/stax/snapshots/operation_fee_0.05.png new file mode 100644 index 000000000..ce6f00431 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_fee_0.05.png differ diff --git a/tests/integration/stax/snapshots/operation_parameter_CAR.png b/tests/integration/stax/snapshots/operation_parameter_CAR.png new file mode 100644 index 000000000..55a336c2b Binary files /dev/null and b/tests/integration/stax/snapshots/operation_parameter_CAR.png differ diff --git a/tests/integration/stax/snapshots/operation_proof_396...834_0.png b/tests/integration/stax/snapshots/operation_proof_396...834_0.png new file mode 100644 index 000000000..ec2db1ff6 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_proof_396...834_0.png differ diff --git a/tests/integration/stax/snapshots/operation_proof_396...834_1.png b/tests/integration/stax/snapshots/operation_proof_396...834_1.png new file mode 100644 index 000000000..082c6ab15 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_proof_396...834_1.png differ diff --git a/tests/integration/stax/snapshots/operation_proof_396...834_2.png b/tests/integration/stax/snapshots/operation_proof_396...834_2.png new file mode 100644 index 000000000..69e3662a4 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_proof_396...834_2.png differ diff --git a/tests/integration/stax/snapshots/operation_proof_396...834_3.png b/tests/integration/stax/snapshots/operation_proof_396...834_3.png new file mode 100644 index 000000000..ac6ea6cd5 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_proof_396...834_3.png differ diff --git a/tests/integration/stax/snapshots/operation_proof_396...834_4.png b/tests/integration/stax/snapshots/operation_proof_396...834_4.png new file mode 100644 index 000000000..6d50f6e4b Binary files /dev/null and b/tests/integration/stax/snapshots/operation_proof_396...834_4.png differ diff --git a/tests/integration/stax/snapshots/operation_proof_396...834_5.png b/tests/integration/stax/snapshots/operation_proof_396...834_5.png new file mode 100644 index 000000000..43bf6d92b Binary files /dev/null and b/tests/integration/stax/snapshots/operation_proof_396...834_5.png differ diff --git a/tests/integration/stax/snapshots/operation_proof_396...834_6.png b/tests/integration/stax/snapshots/operation_proof_396...834_6.png new file mode 100644 index 000000000..efeb399bc Binary files /dev/null and b/tests/integration/stax/snapshots/operation_proof_396...834_6.png differ diff --git a/tests/integration/stax/snapshots/operation_rollup_sr163L...v57.png b/tests/integration/stax/snapshots/operation_rollup_sr163L...v57.png new file mode 100644 index 000000000..1913df860 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_rollup_sr163L...v57.png differ diff --git a/tests/integration/stax/snapshots/operation_sign.png b/tests/integration/stax/snapshots/operation_sign.png new file mode 100644 index 000000000..f4bdf104b Binary files /dev/null and b/tests/integration/stax/snapshots/operation_sign.png differ diff --git a/tests/integration/stax/snapshots/operation_storage_limit_4.png b/tests/integration/stax/snapshots/operation_storage_limit_4.png new file mode 100644 index 000000000..9057c26e1 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_storage_limit_4.png differ diff --git a/tests/integration/stax/snapshots/operation_storage_limit_45.png b/tests/integration/stax/snapshots/operation_storage_limit_45.png new file mode 100644 index 000000000..9f53e3521 Binary files /dev/null and b/tests/integration/stax/snapshots/operation_storage_limit_45.png differ diff --git a/tests/integration/stax/test_sign_execute_outbox_messages.py b/tests/integration/stax/test_sign_execute_outbox_messages.py new file mode 100755 index 000000000..0aef60f09 --- /dev/null +++ b/tests/integration/stax/test_sign_execute_outbox_messages.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +# Copyright 2023 Trilitech + +# 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: 0000000000000000000000000000000000000000000000000000000000000000ce00ffdd6102321bc251e4a5190ad5b12b251069d9b4904e02030400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c6396630396632393532643334353238633733336639343631356366633339626335353536313966633535306464346136376261323230386365386538363761613364313361366566393964666265333263363937346161396132313530643231656361323963333334396535396331336239303831663163313162343430616334643334353564656462653465653064653135613861663632306434633836323437643964313332646531626236646132336435666639643864666664613232626139613834 +# signer: tz1dyX3B1CFYa2DfdFLyPtiJCfQRUgPVME6E + +if __name__ == "__main__": + app = stax_app() + + app.assert_screen(SCREEN_HOME_DEFAULT) + + app.send_apdu("800f000011048000002c800006c18000000080000000"); + app.expect_apdu_return("9000"); + + app.assert_screen("review_request_sign_operation"); + + app.send_apdu("800f0100eb030000000000000000000000000000000000000000000000000000000000000000ce00ffdd6102321bc251e4a5190ad5b12b251069d9b4904e02030400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c63966303966323935326433343532386337333366393436313563666333396263353535363139666335353064643461363762613232303863653865383637616133643133613665663939646662653332633639373461613961323135306432316563613239633333343965353963313362393038316631"); + + app.review.tap() + app.assert_screen("operation_0_sr_outbox") + + app.review.tap() + app.assert_screen("operation_fee_0.01") + + app.review.tap() + app.assert_screen("operation_storage_limit_4") + + app.review.tap() + app.assert_screen("operation_rollup_sr163L...v57") + + app.review.tap() + app.assert_screen("operation_commitment_src12UJ...LY8") + + app.review.tap() + app.expect_apdu_return("9000") + + app.send_apdu("800f82004f63313162343430616334643334353564656462653465653064653135613861663632306434633836323437643964313332646531626236646132336435666639643864666664613232626139613834") + + for i in range(7): + app.review.tap() + app.assert_screen(f"operation_proof_396...834_{i}") + + app.review.tap() + app.assert_screen("operation_sign") + + expected_apdu = "c08f5e1a02d15b05c4066b43fc31aa1ccad30f6c7a18f44723e5af0b6584292236e919219e90793ef502e8883f5317206277607438695933fcb954f4ef451db19628a114880836193c755ddda4bf188b9764231975b2c5ecb64bc4bdc9c459039000" + app.review_confirm_signing(expected_apdu) + + app.assert_screen(SCREEN_HOME_DEFAULT) + app.welcome.quit() diff --git a/tests/integration/stax/test_sign_transfer.py b/tests/integration/stax/test_sign_transfer.py new file mode 100755 index 000000000..86c94ff4b --- /dev/null +++ b/tests/integration/stax/test_sign_transfer.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +# Copyright 2023 Trilitech + +# 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("800f000011048000002c800006c18000000080000000"); + app.expect_apdu_return("9000"); + + app.assert_screen("review_request_sign_operation"); + + app.send_apdu("800f81005e0300000000000000000000000000000000000000000000000000000000000000006c016e8874874d31c3fbd636e924d5a036a43ec8faa7d0860308362d80d30e01000000000000000000000000000000000000000000ff02000000020316"); + + 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 = "f6d5fa0e79cac216e25104938ac873ca17ee9d7f06763719293b413cf2ed475cf63d045a1cc9f73eee5775c5d496fa9d3aa9ae57fb97217f746a8728639795b7b2220e84ce5759ed111399ea3263d810c230d6a4fffcb6e82797c5ca673a17089000" + app.review_confirm_signing(expected_apdu) + + app.assert_screen(SCREEN_HOME_DEFAULT) + app.welcome.quit()