Skip to content

None of the four token_client.transfer calls convert a transfer failure into a typed contract Error #362

Description

@1nonlypiece

create_vault, release_funds, redirect_funds, and cancel_vault each call the plain token_client.transfer(...) (src/lib.rs lines 174, 281, 324, and 360) rather than a try_transfer or similarly fallible variant, meaning a failed transfer — insufficient balance, a frozen or paused USDC asset, or any other rejection by the token contract — causes a raw panic/trap propagating out of DisciplrVault rather than a graceful Err(Error::...) return. This is notable because all four of these functions are typed Result<_, Error>, which strongly suggests to a caller that failures surface as a typed, catchable error; in reality, the single most likely real-world failure mode (the token transfer itself failing) never flows through that Result at all, identical in spirit to how these same functions' success paths always hardcode Ok(true) regardless of what actually happened. Given USDC_INTEGRATION.md's own trust-model notes that the token contract's behavior (freezes, blacklists, pauses) is part of the effective security boundary, converting transfer failures into a typed error (where the SDK's token-client API allows it) would make this failure mode consistent with the rest of the contract's error-handling design and easier for integrators to handle gracefully instead of hitting an opaque panic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions