Skip to content

Commit

Permalink
Return to home after a refill error
Browse files Browse the repository at this point in the history
  • Loading branch information
spalmer25 committed Oct 17, 2023
1 parent a763751 commit d76806b
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/src/ui_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ change_screen_right(void)
if (s->current == s->total) {
if (!s->full)
s->cb(TZ_UI_STREAM_CB_REFILL);
if (global.step == ST_ERROR) {
global.step = ST_IDLE;
ui_home_init();
return;
}
}
// go back to the data screen
succ();
Expand Down
6 changes: 5 additions & 1 deletion app/src/ui_stream_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ tz_ui_nav_cb(uint8_t page, nbgl_pageContent_t *content)
tz_ui_continue();
}

if (global.step != ST_CLEAR_SIGN && global.step != ST_BLIND_SIGN) {
if (global.step == ST_ERROR) {
global.step = ST_IDLE;
ui_home_init();
return false;
} else if (global.step != ST_CLEAR_SIGN && global.step != ST_BLIND_SIGN) {
return false;
} else if (s->full) {
content->type = INFO_LONG_PRESS;
Expand Down
36 changes: 36 additions & 0 deletions tests/integration/nanos/test_parsing_errors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,42 @@ press_button right
expect_full_text 'Parsing error'
press_button both
expect_apdu_return 9405

# 1 byte introduce inside
send_apdu 800f000011048000002c800006c18000000080000000
expect_apdu_return 9000
send_apdu 800f81005f0300000000000000000000000000000000000000000000000000000000000000006c016e8874874d31c3fbd636e924d5a036a43ec8faa7d0860308362d80d30e0100000000000000000000000000000000000000000000ff02000000020316
expect_full_text 'Operation (0)' 'Transaction'
press_button right
expect_full_text 'Fee' '0.05 tz'
press_button right
expect_full_text 'Storage limit' '45'
press_button right
expect_full_text 'Amount' '0.24 tz'
press_button right
expect_section_content nanos 'Destination' 'KT18amZmM5W7qDWVt2pH6uj7sCEd3kbzLrHT'
press_button right
expect_full_text 'Parsing error'
press_button both
expect_apdu_return 9405

# wrong last packet
send_async_apdus \
800f000011048000002c800006c18000000080000000 "expect_apdu_return 9000" \
800f8100eb030000000000000000000000000000000000000000000000000000000000000000ce00ffdd6102321bc251e4a5190ad5b12b251069d9b4904e02030400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c63966303966323935326433343532386337333366393436313563666333396263353535363139666335353064643461363762613232303863653865383637616133643133613665663939646662653332633639373461613961323135306432316563613239633333343965353963313362393038316631 "expect_apdu_return 9002"
expect_section_content nanos 'Operation (0)' 'SR: execute outbox message'
press_button right
expect_section_content nanos 'Fee' '0.01 tz'
press_button right
expect_section_content nanos 'Storage limit' '4'
press_button right
expect_section_content nanos 'Rollup' 'sr163Lv22CdE8QagCwf48PWDTquk6isQwv57'
press_button right
expect_section_content nanos 'Commitment' 'src12UJzB8mg7yU6nWPzicH7ofJbFjyJEbHvwtZdfRXi8DQHNp1LY8'
press_button right
expect_full_text 'ready for' 'safe signing'
expect_async_apdus_sent

press_button right
press_button right
press_button both
Expand Down
18 changes: 18 additions & 0 deletions tests/integration/nanosp/test_parsing_errors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@ press_button right
expect_full_text 'Parsing error' 'ERR_INVALID_TAG'
press_button both
expect_apdu_return 9405

# wrong last packet
send_async_apdus \
800f000011048000002c800006c18000000080000000 "expect_apdu_return 9000" \
800f8100eb030000000000000000000000000000000000000000000000000000000000000000ce00ffdd6102321bc251e4a5190ad5b12b251069d9b4904e02030400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c63966303966323935326433343532386337333366393436313563666333396263353535363139666335353064643461363762613232303863653865383637616133643133613665663939646662653332633639373461613961323135306432316563613239633333343965353963313362393038316631 "expect_apdu_return 9002"
expect_section_content nanosp 'Operation (0)' 'SR: execute outbox message'
press_button right
expect_section_content nanosp 'Fee' '0.01 tz'
press_button right
expect_section_content nanosp 'Storage limit' '4'
press_button right
expect_section_content nanosp 'Rollup' 'sr163Lv22CdE8QagCwf48PWDTquk6isQwv57'
press_button right
expect_section_content nanosp 'Commitment' 'src12UJzB8mg7yU6nWPzicH7ofJbFjyJEbHvwtZdfRXi8DQHNp1LY8'
press_button right
expect_full_text 'Tezos Wallet' 'ready for' 'safe signing'
expect_async_apdus_sent

press_button right
press_button right
press_button both
Expand Down
18 changes: 18 additions & 0 deletions tests/integration/nanox/test_parsing_errors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@ press_button right
expect_full_text 'Parsing error' 'ERR_INVALID_TAG'
press_button both
expect_apdu_return 9405

# wrong last packet
send_async_apdus \
800f000011048000002c800006c18000000080000000 "expect_apdu_return 9000" \
800f8100eb030000000000000000000000000000000000000000000000000000000000000000ce00ffdd6102321bc251e4a5190ad5b12b251069d9b4904e02030400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c63966303966323935326433343532386337333366393436313563666333396263353535363139666335353064643461363762613232303863653865383637616133643133613665663939646662653332633639373461613961323135306432316563613239633333343965353963313362393038316631 "expect_apdu_return 9002"
expect_section_content nanox 'Operation (0)' 'SR: execute outbox message'
press_button right
expect_section_content nanox 'Fee' '0.01 tz'
press_button right
expect_section_content nanox 'Storage limit' '4'
press_button right
expect_section_content nanox 'Rollup' 'sr163Lv22CdE8QagCwf48PWDTquk6isQwv57'
press_button right
expect_section_content nanox 'Commitment' 'src12UJzB8mg7yU6nWPzicH7ofJbFjyJEbHvwtZdfRXi8DQHNp1LY8'
press_button right
expect_full_text 'Tezos Wallet' 'ready for' 'safe signing'
expect_async_apdus_sent

press_button right
press_button right
press_button both
Expand Down
27 changes: 27 additions & 0 deletions tests/integration/stax/test_parsing_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,32 @@
app.send_apdu("800f0100eb0502000000f702000000f202000000ed02000000e802000000e302000000de02000000d902000000d402000000cf02000000ca02000000c502000000c002000000bb02000000b602000000b102000000ac02000000a702000000a2020000009d02000000980200000093020000008e02000000890200000084020000007f020000007a02000000750200000070020000006b02000000660200000061020000005c02000000570200000052020000004d02000000480200000043020000003e02000000390200000034020000002f020000002a02000000250200000020020000001b020000001602000000")
app.expect_apdu_failure("9405")


# wrong last packet
app.send_apdu("800f000011048000002c800006c18000000080000000")
app.expect_apdu_return("9000")

app.assert_screen("review_request_sign_operation")

app.send_apdu("800f8100eb030000000000000000000000000000000000000000000000000000000000000000ce00ffdd6102321bc251e4a5190ad5b12b251069d9b4904e02030400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c63966303966323935326433343532386337333366393436313563666333396263353535363139666335353064643461363762613232303863653865383637616133643133613665663939646662653332633639373461613961323135306432316563613239633333343965353963313362393038316631")

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_failure("9002")

app.assert_screen(SCREEN_HOME_DEFAULT)
app.welcome.quit()

0 comments on commit d76806b

Please sign in to comment.