Skip to content

test: add tests for transfer restriction behaviour - #189

Open
edochieblessing09-max wants to merge 2 commits into
Raegis-RWA:mainfrom
edochieblessing09-max:fix-transfer-restrictions
Open

edochieblessing09-max wants to merge 2 commits into
Raegis-RWA:mainfrom
edochieblessing09-max:fix-transfer-restrictions

Conversation

@edochieblessing09-max

Copy link
Copy Markdown

Closes #161

Summary

This PR introduces comprehensive tests for transfer restriction behaviors. Previously, restricted asset transfers may not have been fully tested across all edge cases (non-compliant actors, paused assets, unauthorized states). This PR addresses those gaps to improve protocol safety and ensure state consistency during failed transactions.

Changes Included

  • Non-compliant Sender Tests: Added test_transfer_reverts_when_sender_blocked and test_transfer_reverts_when_sender_pending to assert that users without Approved compliance clearance cannot initiate a transfer.
  • Non-compliant Recipient Tests: Added test_transfer_reverts_when_receiver_blocked to ensure assets cannot be transferred to addresses with restricted compliance statuses.
  • Asset Lifecycle Restrictions: Added tests (test_transfer_reverts_when_asset_paused, test_transfer_reverts_when_asset_restricted) to verify that asset lifecycle controls correctly block asset movements.
  • Contract-Level Pauses: Added test_transfer_reverts_when_contract_paused to cover unauthorized transfer states triggered by global emergency pauses.
  • State Consistency Checks: Integrated assertions into all failure paths ensuring that balances (bal_before == bal_after) are strictly preserved when a transfer fails.
  • Success Path: Added test_transfer_succeeds as a control to guarantee that correctly configured, compliant actors can transfer assets properly without being overly restricted.

Acceptance Criteria Met

  • Non-compliant sender tests are added.
  • Non-compliant recipient tests are added.
  • Paused or restricted asset tests are added.
  • Unauthorised transfer states are tested.
  • State remains consistent after failed transfers.
  • Docs explain transfer restrictions (covered in docs/transfer-restrictions.md).

Impact

These tests lock in the expected behavior of the transfer validation pipeline. By guaranteeing that all restriction paths revert flawlessly without mutating state, we heavily mitigate the risk of illegal asset movements.

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.

Add Aegis transfer restriction tests

1 participant