Skip to content

Meilu/tbor tests hash - #698

Open
meilu-git wants to merge 4 commits into
mainfrom
meilu/tbor_tests_hash
Open

Meilu/tbor tests hash#698
meilu-git wants to merge 4 commits into
mainfrom
meilu/tbor_tests_hash

Conversation

@meilu-git

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 _emu suffix.
  • Adds extensive new Hash command 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.

Comment thread ddi/tbor/types/tests/commands/hash.rs
Copilot AI review requested due to automatic review settings September 4, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 _emu suffix 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_rejected test case list includes both 0 and HASH_ALGO_SHA256.wrapping_sub(1). Given HASH_ALGO_SHA256 is 1, 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants