Refactor bilateral offline tests for shared mode#142
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
This makes tests stable in shared single-process mode while preserving protocol coverage for receiver settlement and shared transaction visibility.