Skip to content

Commit

Permalink
Fix wording and amount display
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Oct 29, 2024
1 parent 5179c76 commit a84c9cf
Show file tree
Hide file tree
Showing 73 changed files with 42 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion starknet/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "starknet"
version = "2.2.0"
version = "2.2.1"
edition = "2021"
authors = ["Ledger"]

Expand Down
7 changes: 4 additions & 3 deletions starknet/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub fn show_tx(ctx: &mut Ctx) -> Option<bool> {

let review = NbglReview::new()
.tx_type(TransactionType::Transaction)
.titles("Review", "Transaction", "Sign Transaction")
.titles("Review transaction", "", "Sign Transaction ?")
.glyph(&APP_ICON);

Some(review.show(&my_fields))
Expand Down Expand Up @@ -171,7 +171,7 @@ pub fn show_tx(ctx: &mut Ctx) -> Option<bool> {

let review = NbglReview::new()
.tx_type(TransactionType::Transaction)
.titles("Review", "Transaction", "Sign Transaction")
.titles("Review transaction", "", "Sign Transaction ?")
.glyph(&APP_ICON);

Some(review.show(&my_fields))
Expand Down Expand Up @@ -413,7 +413,7 @@ pub fn main_ui_nbgl(_comm: &mut Comm) -> NbglHomeAndSettings {
// Load glyph from 64x64 4bpp gif file with include_gif macro. Creates an NBGL compatible glyph.
const APP_ICON: NbglGlyph = NbglGlyph::from_include(include_gif!("starknet_64x64.gif", NBGL));

let settings_strings = [["Enable Blind signing", "Allow blind signing"]];
let settings_strings = [["Blind signing", "Enable transaction blind signing"]];
let mut settings: Settings = Default::default();

// Display the home screen.
Expand All @@ -427,6 +427,7 @@ pub fn main_ui_nbgl(_comm: &mut Comm) -> NbglHomeAndSettings {
.settings(settings.get_mut(), &settings_strings)
}

#[allow(unused_variables)]
pub fn blind_signing_enable_ui(ctx: &mut Ctx) {
#[cfg(not(any(target_os = "stax", target_os = "flex")))]
{
Expand Down
7 changes: 6 additions & 1 deletion starknet/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,15 @@ impl FieldElement {
#[allow(clippy::wrong_self_convention)]
pub fn to_dec_string(&self, decimals: Option<usize>) -> String {
let bn = BigUint::from_bytes_be(self.value.as_ref());
if bn == BigUint::ZERO {
return "0".to_string();
}
match decimals {
Some(d) => {
let bn_str = bn.to_string();
let mut bn_str = bn.to_string();
let len = bn_str.len();
if len <= d {
bn_str = bn_str.trim_end_matches('0').to_string();
let mut s = String::from("0.");
s.push_str(&"0".repeat(d - len));
s.push_str(&bn_str);
Expand All @@ -102,6 +106,7 @@ impl FieldElement {
let (int_part, dec_part) = bn_str.split_at(len - d);
let mut s = String::from(int_part);
s.push('.');
let dec_part = dec_part.trim_end_matches('0');
s.push_str(dec_part);
s
}
Expand Down
Binary file modified tests/snapshots/flex/test_app_mainmenu/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_deploy_v1/00000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_deploy_v1/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_deploy_v1/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_deploy_v3/00000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_deploy_v3/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_deploy_v3/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_0/00000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_0/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_0/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_0/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_1/00000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_1/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_1/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_2/00000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_2/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_2/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_2/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_3/00000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_3/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_clear_sign_tx_3/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanosp/test_app_mainmenu/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanosp/test_clear_sign_deploy_v1/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanosp/test_clear_sign_deploy_v3/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanosp/test_clear_sign_tx_0/00004.png
Binary file modified tests/snapshots/nanosp/test_clear_sign_tx_0/00007.png
Binary file modified tests/snapshots/nanosp/test_clear_sign_tx_1/00004.png
Binary file modified tests/snapshots/nanosp/test_clear_sign_tx_2/00004.png
Binary file modified tests/snapshots/nanosp/test_clear_sign_tx_2/00007.png
Binary file modified tests/snapshots/nanosp/test_clear_sign_tx_3/00004.png
Binary file modified tests/snapshots/nanox/test_app_mainmenu/00001.png
Binary file modified tests/snapshots/nanox/test_clear_sign_deploy_v1/00003.png
Binary file modified tests/snapshots/nanox/test_clear_sign_deploy_v3/00003.png
Binary file modified tests/snapshots/nanox/test_clear_sign_tx_0/00004.png
Binary file modified tests/snapshots/nanox/test_clear_sign_tx_0/00007.png
Binary file modified tests/snapshots/nanox/test_clear_sign_tx_1/00004.png
Binary file modified tests/snapshots/nanox/test_clear_sign_tx_2/00004.png
Binary file modified tests/snapshots/nanox/test_clear_sign_tx_2/00007.png
Binary file modified tests/snapshots/nanox/test_clear_sign_tx_3/00004.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/00001.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/00002.png
Binary file modified tests/snapshots/stax/test_clear_sign_deploy_v1/00000.png
Binary file modified tests/snapshots/stax/test_clear_sign_deploy_v1/00001.png
Binary file modified tests/snapshots/stax/test_clear_sign_deploy_v1/00002.png
Binary file modified tests/snapshots/stax/test_clear_sign_deploy_v1/00003.png
Binary file modified tests/snapshots/stax/test_clear_sign_deploy_v1/00004.png
Diff not rendered.
Binary file modified tests/snapshots/stax/test_clear_sign_deploy_v3/00000.png
Binary file modified tests/snapshots/stax/test_clear_sign_deploy_v3/00001.png
Binary file modified tests/snapshots/stax/test_clear_sign_deploy_v3/00002.png
Binary file modified tests/snapshots/stax/test_clear_sign_deploy_v3/00003.png
Binary file modified tests/snapshots/stax/test_clear_sign_deploy_v3/00004.png
Diff not rendered.
Binary file modified tests/snapshots/stax/test_clear_sign_tx_0/00000.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_0/00001.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_0/00002.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_0/00003.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_1/00000.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_1/00001.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_1/00003.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_2/00000.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_2/00001.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_2/00002.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_2/00003.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_3/00000.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_3/00001.png
Binary file modified tests/snapshots/stax/test_clear_sign_tx_3/00003.png
44 changes: 30 additions & 14 deletions tests/test_clear_sign_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,21 @@ def test_clear_sign_deploy_v3(firmware, backend, navigator, test_name):
ROOT_SCREENSHOT_PATH,
test_name)
else:
instructions = [
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.USE_CASE_REVIEW_CONFIRM,
NavInsID.USE_CASE_STATUS_DISMISS
]
if firmware.device == "stax":
instructions = [
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.USE_CASE_REVIEW_CONFIRM,
NavInsID.USE_CASE_STATUS_DISMISS
]
else:
instructions = [
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.USE_CASE_REVIEW_CONFIRM,
NavInsID.USE_CASE_STATUS_DISMISS
]
navigator.navigate_and_compare(ROOT_SCREENSHOT_PATH,
test_name,
instructions)
Expand Down Expand Up @@ -97,13 +105,21 @@ def test_clear_sign_deploy_v1(firmware, backend, navigator, test_name):
ROOT_SCREENSHOT_PATH,
test_name)
else:
instructions = [
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.USE_CASE_REVIEW_CONFIRM,
NavInsID.USE_CASE_STATUS_DISMISS
]
if firmware.device == "stax":
instructions = [
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.USE_CASE_REVIEW_CONFIRM,
NavInsID.USE_CASE_STATUS_DISMISS
]
else:
instructions = [
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.SWIPE_CENTER_TO_LEFT,
NavInsID.USE_CASE_REVIEW_CONFIRM,
NavInsID.USE_CASE_STATUS_DISMISS
]
navigator.navigate_and_compare(ROOT_SCREENSHOT_PATH,
test_name,
instructions)
Expand Down

0 comments on commit a84c9cf

Please sign in to comment.