Skip to content

Refactor bilateral offline tests for shared mode#142

Merged
cryptskii merged 1 commit intomainfrom
beta-bilateral-hardening
Apr 4, 2026
Merged

Refactor bilateral offline tests for shared mode#142
cryptskii merged 1 commit intomainfrom
beta-bilateral-hardening

Conversation

@cryptskii
Copy link
Copy Markdown
Collaborator

Adapt bilateral offline integration tests to shared single-process test mode by removing assumptions about sender-local persistence and BCR projections and focusing on receiver-side settlement and shared history visibility.

Changes:

  • Remove sender balance and BCR state assertions that were not a faithful proxy for independent device DBs.
  • Keep and assert receiver-side balance projections and transaction-history visibility.
  • Add helper functions: assert_receiver_projection, history_contains_transfer, assert_shared_history_visibility, and parameterized single-direction transfer helpers for ERA/dBTC.
  • Replace previous round-trip tests with fresh-setup single-direction tests (ERA and dBTC) and a repeated fresh-setup same-direction test.
  • Fix execute_bilateral_transfer to process the commit response on the sender and clone the sender public key when configuring receipts.

This makes tests stable in shared single-process mode while preserving protocol coverage for receiver settlement and shared transaction visibility.

Adapt bilateral offline integration tests to shared single-process test mode by removing assumptions about sender-local persistence and BCR projections and focusing on receiver-side settlement and shared history visibility.

Changes:
- Remove sender balance and BCR state assertions that were not a faithful proxy for independent device DBs.
- Keep and assert receiver-side balance projections and transaction-history visibility.
- Add helper functions: assert_receiver_projection, history_contains_transfer, assert_shared_history_visibility, and parameterized single-direction transfer helpers for ERA/dBTC.
- Replace previous round-trip tests with fresh-setup single-direction tests (ERA and dBTC) and a repeated fresh-setup same-direction test.
- Fix execute_bilateral_transfer to process the commit response on the sender and clone the sender public key when configuring receipts.

This makes tests stable in shared single-process mode while preserving protocol coverage for receiver settlement and shared transaction visibility.
Copilot AI review requested due to automatic review settings April 4, 2026 03:51
@cryptskii cryptskii merged commit bd2b62d into main Apr 4, 2026
5 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors bilateral offline integration tests to run reliably in shared single-process test mode by removing sender-local persistence assumptions while keeping coverage for receiver-side settlement and shared transaction-history visibility.

Changes:

  • Update bilateral transfer test assertions to focus on receiver balance projections and shared history visibility, removing sender balance/BCR assertions that don’t hold in shared DB mode.
  • Add reusable helper assertions for receiver projections and history contents, plus parameterized single-direction transfer helpers for ERA and dBTC.
  • Ensure the test transfer helper runs the full offline bilateral flow by having the sender process the receiver’s commit response, and fix receipt identity setup by cloning the sender public key where needed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
dsm_client/deterministic_state_machine/dsm_sdk/tests/bilateral_round_trip.rs Reworks tests into fresh-setup single-direction cases and adds helper assertions; fixes full-flow execution by processing commit response on sender.
dsm_client/deterministic_state_machine/dsm_sdk/tests/bilateral_full_offline_flow.rs Adjusts test intent/docs and removes sender-local projection/BCR assertions, retaining receiver settlement + history verification.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

3 participants