Skip to content

feat(sdk): adopt bounded asset-lock funding, settled top-ups and the DPNS contest policy in wasm-sdk, rs-sdk-ffi and rs-platform-wallet #5800

Open

Description

@PastaPastaPasta

Summary

#5786 adds rs-sdk APIs for funding identities from asset locks without ever resending refused bytes, for settling a top-up only on proof that its lock was used up, and for registering a DPNS name under an explicit contest policy. Only dash-sdk-cxx (Dash Core's Platform GUI) uses them. wasm-sdk, rs-sdk-ffi (Swift) and rs-platform-wallet (Kotlin) keep their current behaviour, which has the defects below. This issue tracks adopting the new APIs there.

Background

Tenderdash keeps the hash of every transition its CheckTx refused, with no time limit, until its cache evicts it or the node restarts, and a node that holds it never runs CheckTx on those bytes again. The 24 h ttl-duration covers admitted transactions only. So a funding submission is the pair (proof, user_fee_increase), and no pair should be sent twice. Once a proof's fee steps are used up, the next proof is a ChainLock proof for the same outpoint at a height no earlier proof carried. asset_lock_submission's module docs ("Refused transitions") have the details.

APIs to adopt

  • asset_lock_submission::submit_funding_with_fee_floor: the ChainLock-height (10506) retry from the caller's floor, capped at MAX_FUNDING_FEE_INCREASE (100) and FUNDING_ATTEMPTS (15), reporting each attempt's fee before it is built, with FundingFailure { kind, error } / funding_failure_kind saying what to do next.
  • asset_lock_submission::next_chain_lock_proof: the proof a capped lock is sent with next (the mined height, or one above the last ChainLock proof sent, at most the caller's verified ChainLock).
  • TopUpIdentity::top_up_identity_settled: settles only when Sdk::asset_lock_outpoint_state proves the lock used up; otherwise Submitted. Signer path only today; wasm-sdk needs a private-key variant sharing the same settlement rule.
  • DpnsContestPolicy with Sdk::register_dpns_name_under_policy: the contest decision is made on the registration's own build, before any preorder read, delete or write.

Defects this closes

  • rs-platform-wallet: each resume restarts from the caller's fee with the same mined-height proof and persists nothing, so it can resend pairs a node already refused. It should persist the proof generation (the ChainLock height sent and the last fee) with the reservation, before each send. It also retires a tracked top-up lock on the top-up's Ok, which only proves a verified snapshot of the identity's balance, not that the lock was used; it should keep the lock tracked while the outcome is Submitted.
  • wasm-sdk and rs-sdk-ffi: submit_with_cl_height_retry has no fee cap and reports no attempts, and a top-up's Ok does not settle its lock.

Smaller items from #5786's review

  • top_up_identity_settled takes no PutSettings, so callers cannot set timeouts or retries. Add it before other SDKs adopt the method.
  • DPNS: no test inspects the encoded prefunded_voting_balance of the domain document for Cap(0) and Cap(n). The current tests observe that the SDK does not price the contest itself; the exact value is forwarded correctly on inspection.

Reference

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