Skip to content

test: add adversarial coverage for get_pending_transfer_details - #1300

Closed
Somtexzy wants to merge 7 commits into
RevoraOrg:masterfrom
Somtexzy:fix/issue-1055-add-adversarial-coverage-for-get-pending
Closed

Somtexzy wants to merge 7 commits into
RevoraOrg:masterfrom
Somtexzy:fix/issue-1055-add-adversarial-coverage-for-get-pending

Conversation

@Somtexzy

Copy link
Copy Markdown

Overview

This PR adds focused adversarial test coverage for the public get_pending_transfer_details contract in src/lib.rs. The new tests exercise valid lookups, boundary and invalid inputs for env, issuer, namespace, and token, unauthorized caller behavior, and verify that rejected operations leave contract state unchanged.

Related Issue

Changes

🧪 Adversarial Test Coverage

  • [ADD] src/test_pending_issuer_transfer.rs
    • Focused test module covering get_pending_transfer_details success and failure paths.
    • Valid-call cases: existing pending transfer returns the expected details for the given issuer, namespace, and token.
    • Boundary / invalid input cases: unknown namespace, unknown token, mismatched issuer, and empty/absent pending transfer entries return deterministic "not found"-style results rather than panicking.
    • Unauthorized-caller cases: calls from an address that is not the recorded issuer are rejected with the expected error.
    • State-invariance assertions: after each rejected call, the pending transfer record is re-read and confirmed unchanged (no mutation, no partial writes).

Verification Results

cargo test test_pending_transfer_details
✅ focused tests pass (valid, boundary, unauthorized, state-invariance)

cargo test
✅ surrounding suite passes

cargo clippy --all-targets -- -D warnings
✅ no warnings

cargo build
✅ builds cleanly
Acceptance Criteria Status
Cover the named behavior with focused automated tests, including success and failure paths ✅ Valid, boundary, and unauthorized cases covered in src/test_pending_issuer_transfer.rs
Preserve the existing public contract ✅ No changes to get_pending_transfer_details signature or behavior
Make error and boundary behavior observable and deterministic ✅ Rejected calls assert specific error results and unchanged state

Closes #1055

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 adversarial coverage for get_pending_transfer_details in lib

3 participants