Skip to content

Commit 7c1d9f4

Browse files
committed
update test snapshots
1 parent 3bfa55f commit 7c1d9f4

File tree

137 files changed

+288
-342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+288
-342
lines changed

Cargo.lock

Lines changed: 28 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ authors = ["Ledger"]
55
edition = "2021"
66

77
[dependencies]
8-
ledger_device_sdk = "1.24.4"
9-
ledger_secure_sdk_sys = "1.11.1"
10-
include_gif = "1.2.1"
11-
serde = { version = "1.0.192", default-features = false, features = ["derive"] }
8+
ledger_device_sdk = "1.26.0"
9+
ledger_secure_sdk_sys = "1.11.3"
10+
include_gif = "1.2.4"
11+
serde = { version = "1.0.228", default-features = false, features = ["derive"] }
1212
serde-json-core = { git = "https://github.com/rust-embedded-community/serde-json-core" }
1313
hex = { version = "0.4.3", default-features = false, features = [
1414
"serde",
1515
"alloc",
1616
] }
17-
numtoa = "0.2.4"
17+
numtoa = "0.3.1"
1818

1919
bech32 = { version = "0.11", default-features = false, features = ["alloc"] }
2020
chrono = { version = "0.4", default-features = false, features = ["alloc"] }

src/app_ui/address.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ pub fn ui_display_pk(uncompressed_key: &[u8; 65], coin_type: CoinType) -> Result
5959
// Display the address confirmation screen.
6060
Ok(NbglAddressReview::new()
6161
.glyph(&FERRIS)
62-
.verify_str("Verify CRAB address")
62+
.review_title("Verify ML address")
6363
.show(&addr))
6464
}

src/app_ui/sign.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ use chrono::{TimeZone, Utc};
3333
use include_gif::include_gif;
3434
use ledger_device_sdk::{
3535
hash::{blake2::Blake2b_512, HashInit},
36-
nbgl::{Field, NbglGlyph, NbglReview, NbglStreamingReview, TransactionType},
36+
nbgl::{
37+
Field, NbglGlyph, NbglReview, NbglStreamingReview, NbglStreamingReviewStatus,
38+
TransactionType,
39+
},
3740
};
3841
use ml_common::{
3942
Amount, Destination, IsTokenFreezable, NftIssuance, OutputTimeLock, OutputValue, TokenIssuance,
@@ -68,7 +71,12 @@ pub fn streaming_review_show_output(
6871
value: &value,
6972
}];
7073

71-
Ok(review.continue_review(&fields))
74+
let res = match review.next(&fields) {
75+
NbglStreamingReviewStatus::Rejected => false,
76+
NbglStreamingReviewStatus::Next | NbglStreamingReviewStatus::Skipped => true,
77+
};
78+
79+
Ok(res)
7280
}
7381

7482
pub fn approve_streaming_review(
@@ -121,9 +129,10 @@ pub fn approve_streaming_review(
121129
value: &fees,
122130
}];
123131

124-
if !review.continue_review(&fields) {
125-
return Ok(false);
126-
}
132+
match review.next(&fields) {
133+
NbglStreamingReviewStatus::Rejected => return Ok(false),
134+
NbglStreamingReviewStatus::Next | NbglStreamingReviewStatus::Skipped => {}
135+
};
127136

128137
let title = transaction_title(ctx);
129138
Ok(review.finish(title))
@@ -208,7 +217,7 @@ pub fn ui_display_tx(ctx: &TxContext, outputs: &[TxOutput]) -> Result<bool, AppS
208217
}
209218

210219
fn transaction_title(tx: &TxContext) -> &'static str {
211-
let title = match tx.tx_type {
220+
match tx.tx_type {
212221
None | Some(TxType::ComplexTransaction) => "Sign transaction",
213222
Some(TxType::Transfer) => "Sign transfer transaction",
214223
Some(TxType::Burn) => "Sign burn transaction",
@@ -232,8 +241,7 @@ fn transaction_title(tx: &TxContext) -> &'static str {
232241
Some(TxType::FreezeOrder) => "Sign freeze Order transaction",
233242
Some(TxType::ConcludeOrder) => "Sign conclude Order transaction",
234243
Some(TxType::DataDeposit) => "Sign data deposit transaction",
235-
};
236-
title
244+
}
237245
}
238246

239247
/// Displays a message for review and signing confirmation on the device.

src/handlers/get_public_key.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use ledger_device_sdk::io::Comm;
2626

2727
pub fn handler_get_public_key(comm: &mut Comm, display: bool) -> Result<(), AppSW> {
2828
let data = comm.get_data().map_err(|_| AppSW::WrongApduLength)?;
29-
let chain_type = CoinType::try_from(*data.get(0).ok_or(AppSW::WrongApduLength)?)?;
29+
let chain_type = CoinType::try_from(*data.first().ok_or(AppSW::WrongApduLength)?)?;
3030
let path = Bip32Path::decode_all(&mut &data[1..]).map_err(|_| AppSW::DeserializeFail)?;
3131

3232
if path.as_ref().len() < 3 {
@@ -41,10 +41,8 @@ pub fn handler_get_public_key(comm: &mut Comm, display: bool) -> Result<(), AppS
4141
let code = cc.ok_or(AppSW::KeyDeriveFail)?;
4242

4343
// Display address on device if requested
44-
if display {
45-
if !ui_display_pk(&pk.pubkey, chain_type)? {
46-
return Err(AppSW::Deny);
47-
}
44+
if display && !ui_display_pk(&pk.pubkey, chain_type)? {
45+
return Err(AppSW::Deny);
4846
}
4947

5048
comm.append(&[pk.pubkey.len() as u8]);

src/handlers/sign_message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn handler_sign_message(
6363
let data = comm.get_data().map_err(|_| AppSW::WrongApduLength)?;
6464

6565
if chunk == 0 {
66-
let coin: CoinType = (*data.get(0).ok_or(AppSW::WrongApduLength)?).try_into()?;
66+
let coin: CoinType = (*data.first().ok_or(AppSW::WrongApduLength)?).try_into()?;
6767
let addr_type: AddrType = (*data.get(1).ok_or(AppSW::WrongApduLength)?).try_into()?;
6868
let path = Bip32Path::decode_all(&mut &data[2..]).map_err(|_| AppSW::DeserializeFail)?;
6969
if path.as_ref().get(1) != Some(&coin.coin_path()) {

src/handlers/sign_tx.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl TxContext {
294294
self.review_finished
295295
}
296296

297-
fn advance_next_input_step<'a, 'b>(&'a mut self, num_inp: usize) -> SigningState<'b> {
297+
fn advance_next_input_step<'a>(&mut self, num_inp: usize) -> SigningState<'a> {
298298
self.state = if num_inp < (self.num_inputs - 1) as usize {
299299
TxParsingState::Input(num_inp + 1)
300300
} else {
@@ -304,11 +304,11 @@ impl TxContext {
304304
SigningState::TxParsingNotComplete
305305
}
306306

307-
fn advance_next_input_commitment_step<'a, 'b>(
308-
&'a mut self,
307+
fn advance_next_input_commitment_step<'a>(
308+
&mut self,
309309
num_inp: usize,
310-
review: &'b Review,
311-
) -> SigningState<'b> {
310+
review: &'a Review,
311+
) -> SigningState<'a> {
312312
self.state = if num_inp < (self.num_inputs - 1) as usize {
313313
TxParsingState::InputCommitement(num_inp + 1)
314314
} else {

0 commit comments

Comments
 (0)