Skip to content

Commit

Permalink
Fix final hash calculation for the subintents; Fix settings menu; Bum…
Browse files Browse the repository at this point in the history
…p application version
  • Loading branch information
siy committed Nov 1, 2024
1 parent 339b94d commit 02b07af
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "babylon-ledger-app"
version = "0.7.29"
version = "0.7.30"
authors = ["siy"]
edition = "2021"
description = "Radix Babylon"
Expand Down
8 changes: 4 additions & 4 deletions sbor/src/digest/hash_calculator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,10 @@ impl<T: Digester> HashCalculator<T> {

fn si_finalize(&mut self) -> Result<Digest, T::Error> {
let digest = self.output_digester.finalize()?;
self.work_digester.reset();
self.work_digester.update(&Self::SI_INITIAL_VECTOR)?;
self.work_digester.update(digest.as_bytes())?;
self.work_digester.finalize()
self.output_digester.init()?;
self.output_digester.update(&Self::SI_INITIAL_VECTOR)?;
self.output_digester.update(digest.as_bytes())?;
self.output_digester.finalize()
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/sign/tx_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,11 @@ impl<T: Copy> TxState<T> {
comm: &mut Comm,
sign_mode: SignMode,
) -> Result<SignOutcome, AppError> {
let digest = self.processor.finalize()?;

if !(Settings::get().blind_signing) {
return Err(AppError::BadSubintentSignState);
}

let digest = self.processor.finalize()?;
self.finalize_sign_si(comm, sign_mode, &digest)
}

Expand Down
4 changes: 4 additions & 0 deletions src/ui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::ui::multiline_scroller::LINE2_Y;
use crate::ui::utils::{CenteredText, TopCenter};

pub enum MenuFeature<'a> {
Plain,
Icon(&'a Icon<'a>),
OnOffState(fn() -> bool),
}
Expand Down Expand Up @@ -48,6 +49,9 @@ impl<'a, const N: usize> Menu<'a, N> {
let item = &self.items[self.current];

match item.feature {
MenuFeature::Plain => {
item.text.draw_centered(true);
}
MenuFeature::Icon(icon) => {
item.text.place(
Location::Custom(LINE2_Y + icon.icon.height as usize / 2),
Expand Down
3 changes: 1 addition & 2 deletions src/ui/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::ui::multiline_scroller::{LINE1_Y, LINE2_Y, LINE3_Y};
use include_gif::include_gif;
use ledger_device_sdk::ui::bagls::Icon;
use ledger_device_sdk::ui::bitmaps::{Glyph, BACK};
use ledger_device_sdk::ui::bitmaps::Glyph;
use ledger_device_sdk::ui::layout::{Draw, Layout, Location, StringPlace};
use ledger_device_sdk::ui::{SCREEN_HEIGHT, SCREEN_WIDTH};

Expand Down Expand Up @@ -49,4 +49,3 @@ impl TopCenter for Icon<'_> {

pub const RADIX_LOGO: Glyph = Glyph::from_include(include_gif!("icons/nanox_app_radix.gif"));
pub const RADIX_LOGO_ICON: Icon = Icon::from(&RADIX_LOGO);
pub const BACK_ICON: Icon = Icon::from(&BACK);
8 changes: 2 additions & 6 deletions src/xui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod main_menu {
use crate::ui::menu::{Menu, MenuFeature, MenuItem};
use crate::ui::multipage_validator::MultipageValidator;
use crate::ui::single_message::SingleMessage;
use crate::ui::utils::{BACK_ICON, RADIX_LOGO_ICON};
use crate::ui::utils::RADIX_LOGO_ICON;
use ledger_device_sdk::ui::bagls::{
CERTIFICATE_ICON, COGGLE_ICON, DASHBOARD_X_ICON, PROCESSING_ICON,
};
Expand Down Expand Up @@ -48,11 +48,7 @@ pub mod main_menu {
"\nBlind Signing",
blind_signing_setting_action,
),
MenuItem::new(
MenuFeature::Icon(&BACK_ICON),
"\nBack",
back_from_setting_action,
),
MenuItem::new(MenuFeature::Plain, "\nBack", back_from_setting_action),
];

Menu::new(menu).event_loop();
Expand Down

0 comments on commit 02b07af

Please sign in to comment.