Skip to content

platform-wallet: report a malformed invitation funding proof as a typed error, not ErrorUnknown #5496

Open

Description

@romchornyi

Problem

A structurally valid DIP-13 invitation link whose funding proof is malformed reaches the wallet as a generic, retryable error, so the app cannot tell "this link can never be claimed" from "the network did not answer".

At v5.1-dev (41b6acb), parse_invitation_uri keeps the link's islock as a string without decoding it, so the structural preview accepts the link. Once the funding transaction is fetched, inspect_funding_tx (packages/rs-platform-wallet/src/wallet/identity/network/invitation.rs) rejects the proof with PlatformWalletError::InvalidIdentityData in three cases:

  • invitation islock is not valid hex
  • invitation islock could not be decoded
  • invitation islock does not lock the funding transaction

InvalidIdentityData has no arm in impl From<PlatformWalletError> for PlatformWalletFFIResult (packages/rs-platform-wallet-ffi/src/error.rs), so it falls through to ErrorUnknown, and Swift receives an unknown PlatformWalletError. The same happens for invitationClaimStatus, invitationProspectiveIdentityId and claimInvitation.

Effect

dashwallet-ios (dashpay/dashwallet-ios#1156) maps invalidParameter and invalidNetwork from the status query to a definitive "invalid invitation" and treats everything else as undetermined, which keeps the invitation and offers Retry. A link with a malformed islock therefore stays stored and offers Retry forever. Mapping ErrorUnknown to "invalid" is not an option on the app side: it also covers transport and funding-data failures that a later retry can succeed on.

Proposed change

Give a malformed funding proof its own typed result across the Rust → FFI → Swift boundary, e.g. a dedicated PlatformWalletError variant (or InvalidParameter, if that matches the contract) for the three cases above, with its own FFI result code and Swift case. Keep InvalidIdentityData for failures that are not a defect of the link itself. Add a regression for each of the three cases through the FFI.

Raised in review on dashpay/dashwallet-ios#1156 (thread dashpay/dashwallet-ios#1156 (comment)), deferred there as a platform change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions