Skip to content

Carry the payment class through the remaining host screens and state-transition exports #6009

Open

Description

@romchornyi

Follow-up from #5928, which carries Rust's payment class (delivery, retry, held lock) through the FFI, JNI, Swift and Kotlin SDKs and the example apps' payment screens (Send, registration, identity top-up, asset-lock funding, seed pool, DPNS marketplace).

Not yet covered:

  • Example-app screens that still decide from error types or texts: tokens, DashPay, documents, identity withdraw/transfer, masternode withdrawal, CoSign.
  • FFI exports of fee-paying state transitions that return a raw, unclassified error after a successful submission: dpns.rs:92, document.rs (136, 250, 626, 697, 770), tokens/burn.rs:100, tokens/mint.rs:118–140, tokens/transfer.rs:92/96 (via balances_json.rs), decision_proposal.rs:218/289, multiple_choice_proposal.rs:281/358/426, and asset_lock/build.rs:98 (path NUL after the build, which also leaks the transaction bytes already written). Each should go through PlatformWalletFFIResult::handback_failure (MaybeSent).
  • Kotlin Send keeps its failed state in remember, so a held failure is lost on rotation; it should use rememberSaveable.

🤖 Generated with Claude Code

Activity

  1. romchornyi commented on Nov 28, 2026

    @romchornyi
    ContributorAuthor

    More example-app cases from the review of the #5928 split (#5928, #6379, #6380, #6381), deferred here:

    • Kotlin holds kept in remember: besides Send, TopUpIdentityFromCoreScreen, TopUpIdentityScreen and SeedShieldedPoolScreen keep a payment's hold in remember while the form inputs are rememberSaveable, so a configuration change (rotation) clears the hold and re-enables a second payment after a MaybeSent / LockHeld failure.
    • Swift, network switch or SDK rebuild: WalletManagerStore.activate builds a new manager, and the registration, address and shielded funding coordinators go with the old one, so a held failed slot is dropped (same effect as an app restart, but the coordinator docs say .unconfirmed blocks the switch).
    • Swift, wallet delete: deleting a wallet does not clear its controllers in the three coordinators; after re-import under the same wallet id, a .lockHeld slot has no Dismiss or Release until restart.
    • Screens still deciding from the error case: DecisionProposalFormViews, GiveUpNameView, UpdateContractView (in addition to the documents, tip and masternode screens already listed).
  2. romchornyi commented on Nov 28, 2026

    @romchornyi
    ContributorAuthor

    Two more Swift example-app cases of the same hold lifecycle, from the review of #6380, deferred here:

    • ShieldedFundFromAssetLockView, platform-balance shield: the failure lives in the sheet's phase, so closing the sheet drops a MaybeSent hold and a reopened sheet can shield again.
    • TopUpIdentityView: the failure lives in the view's @State, so cancelling and reopening the view drops a MaybeSent / unclassified hold and allows another top-up.

    The holds added in that round to CreateInvitationSheet, DpnsMarketplaceView, CreateIdentityView (address-funded registration) and the address top-up view model (and on Kotlin, CreateInvitationSheet, DpnsMarketplaceScreen) live in view state too; they need the same wallet-level owner.

  3. romchornyi commented on Nov 28, 2026

    @romchornyi
    ContributorAuthor

    Follow-up suggestions from the approval of #6379 (all report a failure more conservatively than it is, none invites a second payment), deferred here:

    • rs-platform-wallet/src/wallet/identity/network/dpns.rs:238: the DPNS contract preflight (self.dpns_contract().await?) runs before any preorder, so its failure should go through before_dispatch (NotSent) instead of the generic MaybeSent.
    • rs-platform-wallet/src/wallet/identity/network/private_contact_requests.rs:1641-1652: preparation errors before pay (signing, sealing, marker persistence, ECDH, address check) should be before_dispatch; errors from pay and later stay as they are.
    • rs-platform-wallet-ffi/src/core_wallet/broadcast.rs:76: an invalid core-wallet handle synthesizes InvalidParameter and reports NotSent; return PlatformWalletFFIResult::err (Unknown) like the adjacent abandon path.
  4. romchornyi commented on Nov 28, 2026

    @romchornyi
    ContributorAuthor

    Two optional follow-ups from thepastaclaw's re-review of #5928 (not inline), tracked here:

  5. romchornyi commented on Nov 28, 2026

    @romchornyi
    ContributorAuthor

    Two more hold-lifecycle cases from the approval of #6380 (optional follow-ups), same wallet-level owner needed:

    • SwiftExampleApp/Core/Views/SendTransactionView.swift:1023-1028: acknowledging an ambiguous Core send keeps paymentFailure but closes the sheet; a reopened Send gets a fresh SendViewModel with no hold.
    • SwiftExampleApp/Views/SeedShieldedPoolView.swift:311-317: a seed run's MaybeSent / LockHeld / unclassified failure lives in the sheet's Phase.failed; reopening starts at .idle and allows another funded run.
  6. romchornyi commented on Nov 28, 2026

    @romchornyi
    ContributorAuthor

    Follow-up from the #5928 stack review (CodeRabbit on #5928, thepastaclaw suggestions on #6379), to land as one PR after the stack merges. Rule: every failure proven to occur before a payment is dispatched is NotSent.

    • wallet/identity/network/invitation.rs (create): the ChainLock-proof refusal after the voucher row is durable returns AssetLockTransaction (MaybeSent), so hold_resumable_lock attaches no held outpoint although the voucher stays tracked and reclaimable.
    • wallet/identity/network/invitation.rs claim_refusal: a preflight InvitationError::Invalid (empty keys_map, malformed link) becomes a bare InvalidIdentityData (MaybeSent); only preflight AlreadyClaimed is wrapped with before_dispatch(). Check every Invalid producer is pre-submit before wrapping it.
    • dpns.rs:238 contract preflight and private_contact_requests.rs:1641-1652 preparation (already listed in Carry the payment class through the remaining host screens and state-transition exports #6009 (comment)).
    • Docs: PaymentDelivery::NotSent and payment_delivery() say NotSent offers a retry; ShieldedTipPending and RefusedBeforeDispatch are NotSent and not retryable. Document NotSent as "this operation cannot pay" and point the retry decision at is_retryable().
  7. romchornyi commented on Dec 1, 2026

    @romchornyi
    ContributorAuthor

    From HashEngineering's approval of #6379 (#6379 (review)), deferred here; each reports a failure more conservatively than it is, or is cosmetic:

    • rs-platform-wallet-ffi/src/shielded_send.rs:2533: the token spend preview's purchaser lookup keeps its own class, so WalletNotFound is MaybeSent on a read-only call whose doc says preview refusals are NotSent. Wrap it with before_dispatch in the wallet's preview path.
    • rs-platform-wallet/src/wallet/identity/network/dpns.rs:238-245: beside the contract preflight listed above, the auth-key lookup is also before any preorder.
    • rs-platform-wallet/src/wallet/identity/network/private_contact_requests.rs:1641-1659: preparation before pay, already listed above.
    • Leftover let message = "…" bindings: core_wallet/broadcast.rs:71, core_wallet/transaction_builder.rs:383, dashpay.rs:1007 and :1015.

    The third item of the earlier list (the invalid handle in core_wallet/broadcast.rs) was fixed in #6379, as was the review's map_tip_send_result point (e4960cbf71).

    🤖 Generated with Claude Code

  8. romchornyi commented on Dec 1, 2026

    @romchornyi
    ContributorAuthor

    Follow-up from #6379 (#6379 (comment)):

    • Move unconfirmed_shielded_errors_promise_no_sync_verdict from packages/rs-platform-wallet-ffi/src/shielded_send.rs to the tests in packages/rs-platform-wallet/src/error.rs, next to the Display texts it checks. It calls only PlatformWalletError::to_string(), and in the FFI crate it runs only with the shielded feature, so the wallet suite does not catch a regression. The panic-message assertion stays in the FFI crate.

    🤖 Generated with Claude Code

  9. romchornyi commented on Dec 1, 2026

    @romchornyi
    ContributorAuthor

    From CodeRabbit's review of #6380 and the sweep for its findings' siblings, deferred here (screen code that #6380 did not add):

    • Wallet drain row (WalletDrainCoordinator.rowAction): a pending report with an outpoint offers Resume while the controller holds an unclassified failure, so the tap only re-presents that failure (its progress screen offers the release). Which action the row should show is a product choice. feat(swift-sdk)!: read Rust's payment class on every PlatformWalletError #6380 (comment)
    • Paid call succeeded, a later local step throws and the screen offers the payment again: ShareLoginKeyView (ephemeral key or seal after the key update), TransitionDetailView (result decoding), AddressQueriesView (missing output of a top-up), eraseDocumentAndObserve (DocumentEraseResultUnreadable carries no class).
    • Screens that read the unconfirmed case, or nothing, instead of .maybeSent: TokenUpdateMaxSupplyActionView, decision proposal edit, multiple choice create / edit / enter, RegisterNameView, DocumentsView actions other than erase, the mint / burn / transfer token forms, credit transfer and withdrawal, ShieldedTipFlow, UpdateKeyLimitsView (a maybe-sent consensus refusal with the limits read unchanged).
    • Core Send: the hold has no confirmed release on the screen; acknowledging closes the form, which drops it.

    🤖 Generated with Claude Code

  10. romchornyi commented on Dec 2, 2026

    @romchornyi
    ContributorAuthor

    One more export for the "raw, unclassified error after a successful submission" list, found in the #6380 review:

    • tokens/update_config.rs:350–353: after token_update_config_and_refresh_with_external_signer succeeds, outcome_json (contract → serialization format), serde_json::to_string and CString::new return plain errors with Unknown delivery. They should go through PlatformWalletFFIResult::handback_failure.

    Related: Swift's PlatformWalletError.readingPaidOutput marks an output Swift cannot decode after a reported success as .maybeSent on its own. Once Rust exposes the handback class to hosts, Swift and Kotlin should take it from there instead.

    Since #6380, the example app already holds a classless failure at these sites (PaymentFailure.holdsSubmission(after:)), so this is about the class being explicit, not about a form reopening.

    🤖 Generated with Claude Code

  11. romchornyi commented on Dec 2, 2026

    @romchornyi
    ContributorAuthor

    Add from platform#6380 (thread #6380 (comment)): masternode withdrawal settlement. After an unconfirmed Claim, MasternodeDetailView keeps Confirm held, but a balance read taken after the failure still releases the hold. A balance does not show whether the submitted withdrawal (its identity nonce) has executed or can no longer execute, and the next Confirm signs a new withdrawal rather than resuming the first. Needed: a platform-wallet call that reports the status of a submitted withdrawal (executed / can no longer execute / still pending), exposed over FFI. The screen should then keep the hold until Rust reports one of the first two, and stop treating a balance read as reconciliation. Same for the Kotlin host.

  12. romchornyi commented on Dec 2, 2026

    @romchornyi
    ContributorAuthor

    Deferred from #6380 (CodeRabbit, ContestDetailView): after an unconfirmed masternode vote (PaymentFailure.holdsSubmission), hold new votes from that proTxHash until the masternode's own recorded vote on the poll has been read; aggregate tallies do not establish whether it landed. Other masternodes and .notSent failures stay eligible. Thread: #6380 (comment)

  13. romchornyi commented on Dec 3, 2026

    @romchornyi
    ContributorAuthor

    Deferred from #6380 (thepastaclaw, Erase): erase_and_observe_with_submit (rs-platform-wallet/src/wallet/identity/network/document_erase.rs) returns early when fetch_contract_arc_for_document_op fails, before a signing key is selected or submit runs, but the helper maps the failure to InvalidIdentityData, which classes MaybeSent. Mark the proven pre-dispatch failures of the erase path with before_dispatch() (errors from submit keep their path), so hosts release the Erase hold for them. Same check for the sibling document operations that share the helper. Thread: #6380 (comment)

  14. romchornyi commented on Dec 3, 2026

    @romchornyi
    ContributorAuthor

    Status after #6464 (draft, stacked on #6381 → #6380): it covers the "FFI exports of fee-paying state transitions that return a raw, unclassified error after a successful submission" item above. Every listed export (DPNS register, document writes, proposals, token mint/burn/transfer/config, contract fee claim and moderation, asset_lock/build.rs path NUL) and the JNI counterparts now carry handback_failure, and the Swift/Kotlin guards read that class instead of choosing .maybeSent.

    Still open here after #6464:

    • Example-app screens that decide from error types or texts (tokens, DashPay, documents, identity withdraw/transfer, masternode withdrawal, CoSign), incl. the generic TransitionDetailView executor.
    • Kotlin Send failed state in remember → rememberSaveable.
    • Erase-unreadable public types.
    • Masternode Claim: hold until Rust reports the withdrawal settled (comment above).
    • ContestDetail: hold a masternode until its own recorded vote is read (comment above).
    • Erase: mark the pre-dispatch contract fetch before_dispatch() (comment above).
  15. romchornyi commented on Dec 3, 2026

    @romchornyi
    ContributorAuthor

    From llbartekll's approval of #6380 (#6380 (review)), SwiftExampleApp, both conservative (no second payment):

    1. A classless failure overwrites a held lock and leaves Resume dead. When a slot is .failed(lockHeld(X)) and the resume of X throws before Rust is asked (admitNativeOp during shutdown, a parameter guard), the controller's catch replaces the phase with a PaymentFailure that has no heldLock, so permitsRestart(resuming: X) refuses Resume and Dismiss; only "Payment checked in history — release" is left, for a payment never sent. ShieldedFundFromAssetLockController.submit, AddressFundFromAssetLockController, IdentityRegistrationController. Fix: keep the previous held lock when the new error carries no class; test a classless failure after a .lockHeld one.
    2. Address top-up resumed to another recipient strands the original slot. FundFromAssetLockPlatformAddressView lets resume mode re-pick the account and recipient, and the slot key includes the recipient. Confirmed against Rust: funding owned Platform addresses records no recipients on v5.2-dev (only feat(platform-wallet): record the payment intent of external asset locks #5930 records them, for external ones), so the resume to B is not refused; slot A stays .failed(lockHeld(L)) with no Dismiss or Release until restart.
  16. romchornyi commented on Dec 3, 2026

    @romchornyi
    ContributorAuthor

    Deferred from #6464 (thepastaclaw, wallet_drain.rs:293): when the JVM cannot allocate the packed drain outcome after a funded lock failed, the generic handback failure (MaybeSent, no outpoint) replaces the native LockHeld and its outpoint, so Kotlin returns WalletDrainOutcome.unresolved with no lock to resume. The durable status read still recovers it. Fix direction: reserve the fixed-size outcome header before dispatch and make the diagnostic text optional, so the native failure and snapshot survive the fallback. Thread: #6464 (comment)

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