What changed, and why it matters
This commit is a routine internal code cleanup. It moves the logic for showing a short status message on the device screen from one Rust function to another and converts it to use the project's async/await pattern. There is no visible change in behavior: the status screen still appears for the same 2-second duration. Nothing in the commit suggests a security fix or vulnerability.
No security action required. Review as normal code-quality/async refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors status-screen handling. Previously, workflow::status created a component via ui::status_create, pushed it onto the screen stack, and awaited a 2-second delay. Now ui::status_create is renamed/replaced by an async ui::status that performs the push and delay internally, so workflow::status simply awaits it. Corresponding stubs are updated. The observable behavior (component creation, screen push, 2000 ms delay) is preserved.
Changed components
src/rust/bitbox02-rust/src/workflow/status.rssrc/rust/bitbox02/src/ui/ui.rssrc/rust/bitbox02/src/ui/ui_stub.rssrc/rust/bitbox02/src/ui/ui_stub_c_unit_tests.rsInspect captured patch +9 / −12
diff --git a/src/rust/bitbox02-rust/src/workflow/status.rs b/src/rust/bitbox02-rust/src/workflow/status.rs
index bef9303..09d71ed 100644
--- a/src/rust/bitbox02-rust/src/workflow/status.rs
+++ b/src/rust/bitbox02-rust/src/workflow/status.rs
@@ -1,10 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
-use bitbox02::delay::delay_for;
-use core::time::Duration;
-
pub async fn status(title: &str, status_success: bool) {
- let mut component = bitbox02::ui::status_create(title, status_success);
- component.screen_stack_push();
- delay_for(Duration::from_millis(2000)).await;
+ bitbox02::ui::status(title, status_success).await;
}
diff --git a/src/rust/bitbox02/src/ui/ui.rs b/src/rust/bitbox02/src/ui/ui.rs
index d6990c7..50ab0c2 100644
--- a/src/rust/bitbox02/src/ui/ui.rs
+++ b/src/rust/bitbox02/src/ui/ui.rs
@@ -14,6 +14,7 @@ use alloc::string::String;
use alloc::vec::Vec;
use core::cell::RefCell;
use core::task::{Poll, Waker};
+use core::time::Duration;
/// Wraps the C component_t to be used in Rust.
pub struct Component {
@@ -248,17 +249,19 @@ pub fn screen_process() {
}
}
-pub fn status_create(text: &str, status_success: bool) -> Component {
+pub async fn status(text: &str, status_success: bool) {
let component = unsafe {
bitbox02_sys::status_create(
util::strings::str_to_cstr_vec(text).unwrap().as_ptr(), // copied in C
status_success,
)
};
- Component {
+ let mut component = Component {
component,
is_pushed: false,
- }
+ };
+ component.screen_stack_push();
+ crate::delay::delay_for(Duration::from_millis(2000)).await;
}
pub async fn sdcard() -> SdcardResponse {
diff --git a/src/rust/bitbox02/src/ui/ui_stub.rs b/src/rust/bitbox02/src/ui/ui_stub.rs
index eb4e84b..9319a06 100644
--- a/src/rust/bitbox02/src/ui/ui_stub.rs
+++ b/src/rust/bitbox02/src/ui/ui_stub.rs
@@ -50,7 +50,7 @@ pub async fn confirm(_params: &ConfirmParams<'_>) -> ConfirmResponse {
pub fn screen_process() {}
-pub fn status_create(_text: &str, _status_success: bool) -> Component {
+pub async fn status(_text: &str, _status_success: bool) {
panic!("not used");
}
diff --git a/src/rust/bitbox02/src/ui/ui_stub_c_unit_tests.rs b/src/rust/bitbox02/src/ui/ui_stub_c_unit_tests.rs
index 3603df7..871e054 100644
--- a/src/rust/bitbox02/src/ui/ui_stub_c_unit_tests.rs
+++ b/src/rust/bitbox02/src/ui/ui_stub_c_unit_tests.rs
@@ -57,12 +57,11 @@ pub async fn confirm(params: &ConfirmParams<'_>) -> ConfirmResponse {
pub fn screen_process() {}
-pub fn status_create(text: &str, _status_success: bool) -> Component {
+pub async fn status(text: &str, _status_success: bool) {
crate::print_stdout(&format!(
"STATUS SCREEN START\nTITLE: {}\nSTATUS SCREEN END\n",
text,
));
- Component { is_pushed: false }
}
pub async fn sdcard() -> SdcardResponse {
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.