What changed, and why it matters
This commit changes a delay function so that it does nothing when running in the simulator or Rust unit tests, restoring fast test execution. It is a developer-experience fix with no security relevance.
No security action needed. This is a benign test/simulator-only quality-of-life change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The delay_for function in src/rust/bitbox02/src/delay.rs is modified to skip the actual delay when compiled with the c-unit-testing or testing feature flags. Previously, a change caused the simulator to wait for real time (e.g., 2 seconds per status), making tests slow. The new implementation is async and conditionally calls Delay::from_ms(...).await only outside simulator/test builds. This affects only test/simulator builds and does not alter behavior on real hardware.
Changed components
src/rust/bitbox02/src/delay.rsInspect captured patch +4 / −2
diff --git a/src/rust/bitbox02/src/delay.rs b/src/rust/bitbox02/src/delay.rs
index 7e1b4a3..b19ba4f 100644
--- a/src/rust/bitbox02/src/delay.rs
+++ b/src/rust/bitbox02/src/delay.rs
@@ -121,6 +121,8 @@ impl Drop for Delay {
}
}
-pub fn delay_for(duration: Duration) -> Delay {
- Delay::from_ms(duration.as_millis() as u32)
+pub async fn delay_for(#[allow(unused)] duration: Duration) {
+ // Do not delay in (non-graphical) simulator and Rust unit tests.
+ #[cfg(not(any(feature = "c-unit-testing", feature = "testing")))]
+ Delay::from_ms(duration.as_millis() as u32).await
}
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.