What changed, and why it matters
This commit is a code cleanup that standardizes the names used for page-number debugging output across different parts of the Trezor user interface. It does not change any user-visible behavior, security logic, or device functionality. There is no security issue here.
No security action required. This is a normal refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors tracing/debug instrumentation for paginated UI components. It unifies trace key names to ‘active_page’ and ‘page_count’ across multiple layouts (caesar, delizia, eckhart) and removes duplicate or inconsistent keys from inner components. One functional-looking change in layout_caesar/component/flow.rs replaces self.page_counter as u16 + inner_page with preceding_pages + inner_page by calling scrollbar_page_index; this is a correctness/consistency fix for scrollbar page numbering within the same refactor, not a security boundary change. All changes are behind #[cfg(feature = "ui_debug")] or affect debug trace output only.
Changed components
core/embed/rust/src/ui/flow/page.rscore/embed/rust/src/ui/layout_caesar/component/flow.rscore/embed/rust/src/ui/layout_caesar/component/flow_pages.rscore/embed/rust/src/ui/layout_caesar/component/scrollbar.rscore/embed/rust/src/ui/layout_delizia/component/footer.rscore/embed/rust/src/ui/layout_delizia/component/more_info_screen.rscore/embed/rust/src/ui/layout_delizia/component/share_words.rscore/embed/rust/src/ui/layout_delizia/component/vertical_menu.rscore/embed/rust/src/ui/layout_eckhart/firmware/hint.rscore/embed/rust/src/ui/layout_eckhart/firmware/regulatory_screen.rscore/embed/rust/src/ui/layout_eckhart/firmware/share_words.rscore/embed/rust/src/ui/layout_eckhart/firmware/text_screen.rsInspect captured patch +19 / −17
### core/embed/rust/src/ui/flow/page.rs
@@ -103,9 +103,11 @@ impl<T: Paginate> Paginate for SwipePage<T> {
#[cfg(feature = "ui_debug")]
impl<T> crate::trace::Trace for SwipePage<T>
where
- T: crate::trace::Trace,
+ T: crate::trace::Trace + Paginate,
{
fn trace(&self, t: &mut dyn crate::trace::Tracer) {
- self.inner.trace(t)
+ self.inner.trace(t);
+ t.int("active_page", self.pager().current().into());
+ t.int("page_count", self.pager().total().into());
}
}
### core/embed/rust/src/ui/layout_caesar/component/flow.rs
@@ -157,9 +157,12 @@ where
/// Current choice is still the same, only its inner state has changed
/// (its sub-page changed).
fn update_after_current_choice_inner_change(&mut self, ctx: &mut EventCtx) {
+ let preceding_pages = self
+ .pages
+ .scrollbar_page_index(self.content_area, self.page_counter);
let inner_page = self.current_page.pager().current();
self.scrollbar.mutate(ctx, |ctx, scrollbar| {
- scrollbar.change_page(self.page_counter as u16 + inner_page);
+ scrollbar.change_page(preceding_pages + inner_page);
scrollbar.request_complete_repaint(ctx);
});
self.update(ctx, false);
@@ -293,6 +296,8 @@ where
t.component("Flow");
t.int("flow_page", self.page_counter as i64);
t.int("flow_page_count", self.pages.count() as i64);
+ t.int("active_page", i64::from(self.scrollbar.pager().current()));
+ t.int("page_count", i64::from(self.scrollbar.pager().total()));
if let Some(title) = &self.title {
t.child("title", title);
### core/embed/rust/src/ui/layout_caesar/component/flow_pages.rs
@@ -189,8 +189,6 @@ impl crate::trace::Trace for Page {
// Not calling it "title" as that is already traced by FlowPage
t.string("page_title", *title);
}
- t.int("active_page", i64::from(self.pager().current()));
- t.int("page_count", i64::from(self.pager().total()));
t.in_list("text", &|l| {
let result = self.formatted.trace_lines_as_list(l);
fit.set(Some(result));
### core/embed/rust/src/ui/layout_caesar/component/scrollbar.rs
@@ -118,7 +118,5 @@ impl Paginate for ScrollBar {
impl crate::trace::Trace for ScrollBar {
fn trace(&self, t: &mut dyn crate::trace::Tracer) {
t.component("ScrollBar");
- t.int("scrollbar_page_count", i64::from(self.pager.total()));
- t.int("scrollbar_active_page", i64::from(self.pager.current()));
}
}
### core/embed/rust/src/ui/layout_delizia/component/footer.rs
@@ -481,8 +481,6 @@ impl PageCounter {
impl crate::trace::Trace for PageCounter {
fn trace(&self, t: &mut dyn crate::trace::Tracer) {
t.component("PageCounter");
- t.int("page current", self.pager.current().into());
- t.int("page max", self.pager.total().into());
}
}
### core/embed/rust/src/ui/layout_delizia/component/more_info_screen.rs
@@ -159,6 +159,7 @@ where
if self.paginated == Some(true) {
t.child("action_bar", &self.action_bar);
}
+ t.int("active_page", i64::from(self.pager().current()));
t.int("page_count", i64::from(self.pager().total()));
}
}
### core/embed/rust/src/ui/layout_delizia/component/share_words.rs
@@ -255,7 +255,8 @@ impl<'a> crate::trace::Trace for ShareWords<'a> {
let word = &self.share_words[self.page_index as usize];
let content = word.map(|w| uformat!("{}. {}\n", self.page_index + 1, w));
t.string("screen_content", content.as_str().into());
- t.int("page_count", self.share_words.len() as i64)
+ t.int("active_page", self.page_index.into());
+ t.int("page_count", self.share_words.len() as i64);
}
}
### core/embed/rust/src/ui/layout_delizia/component/vertical_menu.rs
@@ -576,7 +576,6 @@ impl<F: Fn(u16) -> TString<'static>> crate::trace::Trace for PagedVerticalMenu<F
fn trace(&self, t: &mut dyn crate::trace::Tracer) {
t.component("PagedVerticalMenu");
t.child("inner", &self.inner);
- t.int("page", self.page.into());
t.int("item_count", self.item_count as _);
}
}
### core/embed/rust/src/ui/layout_eckhart/firmware/hint.rs
@@ -353,10 +353,7 @@ impl<'a> crate::trace::Trace for Hint<'a> {
HintContent::Instruction(i) => {
t.child("instruction", &i.label);
}
- HintContent::PageCounter(counter) => {
- t.int("page curr", counter.pager.current().into());
- t.int("page max", counter.pager.total().into());
- }
+ HintContent::PageCounter(_) => {}
}
}
}
### core/embed/rust/src/ui/layout_eckhart/firmware/regulatory_screen.rs
@@ -133,6 +133,7 @@ impl crate::trace::Trace for RegulatoryScreen {
t.child("Header", &self.header);
t.child("Content", &self.content);
t.child("ActionBar", &self.action_bar);
+ t.int("active_page", i64::from(self.content.pager().current()));
t.int("page_count", i64::from(self.content.pager().total()));
}
}
### core/embed/rust/src/ui/layout_eckhart/firmware/share_words.rs
@@ -326,7 +326,8 @@ impl<'a> crate::trace::Trace for ShareWords<'a> {
let word = &self.share_words[self.pager().current() as usize];
let content = word.map(|w| uformat!("{}. {}\n", self.pager().current() + 1, w));
t.string("screen_content", content.as_str().into());
- t.int("page_count", self.share_words.len() as i64)
+ t.int("active_page", i64::from(self.pager().current()));
+ t.int("page_count", self.share_words.len() as i64);
}
}
### core/embed/rust/src/ui/layout_eckhart/firmware/text_screen.rs
@@ -402,7 +402,8 @@ where
if let Some(page_limit) = self.page_limit {
t.int("page_limit", i64::from(page_limit));
}
- t.int("page_count", i64::from(self.content.pager().total()));
+ t.int("active_page", i64::from(self.content_pager().current()));
+ t.int("page_count", i64::from(self.content_pager().total()));
debug_assert!(!(self.external_menu && self.has_flow_menu));
t.bool("has_menu", self.external_menu);Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.