Meilu/tbor tests hash - #698
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The PR only updates/adds tests and the only feedback is a small codebase-convention improvement (avoid a magic PSK id).
Pull request overview
Expands the TBOR Hash command integration test suite to cover more negative paths and correctness properties (including CU/PSK gating), improving confidence that on-device hashing matches host expectations across typical and edge-case inputs.
Changes:
- Renames the existing hash tests to drop the
_emusuffix. - Adds extensive new
Hashcommand test coverage: invalid session/algorithm handling, determinism, message boundary conditions, and CU session scenarios (rotated PSK and default-PSK rejection).
File summaries
| File | Description |
|---|---|
| ddi/tbor/types/tests/commands/hash.rs | Adds comprehensive on-device vs host digest checks and negative-path coverage for TBOR Hash, including CU/PSK gate behaviors. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🔵 Needs a closer look
There are a couple of concrete maintainability/convention issues in the updated tests (including a duplicated invalid-algorithm case and inconsistent emulator test naming) that should be addressed before merging.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
ddi/tbor/types/tests/commands/hash.rs:62
- Most other TBOR command integration tests that are gated to the emulator keep a
_emusuffix on the#[test]function name (e.g.,ddi/tbor/types/tests/commands/hmac.rs:71,ddi/tbor/types/tests/commands/aes_encrypt_decrypt.rs:77). This file is still#![cfg(feature = "emu")], but the test functions were renamed/added without the suffix, which makes the naming inconsistent and can make it harder to filter backend-specific tests by name.
ddi/tbor/types/tests/commands/hash.rs:132 - The
hash_invalid_algos_rejectedtest case list includes both0andHASH_ALGO_SHA256.wrapping_sub(1). GivenHASH_ALGO_SHA256is1, these are the same value, so the test ends up exercising the identical invalid discriminant twice.
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
No description provided.