Skip to content

Identity top-up result: return the credits the top-up added #5852

Open

Description

@romchornyi

Problem

An identity top-up funded from an asset lock returns only the identity's balance after the transition. The client cannot tell how many credits the top-up itself added: Drive credits the asset lock's remaining_credit_value and then charges the transition's fee from it, and that fee never reaches the client.

The wallet has to know the top-up's own share when it watches an identity's balance for incoming credits from other people. With supplied credits S, fee F and a payment X from someone else landing while the top-up runs, the returned balance is B + S − F + X. Without F, the wallet cannot separate X from its own top-up. A payment up to F is absorbed, and a larger one is understated by F (dashpay/dashwallet-ios#1344).

Where the number already is

  • rs-drive-abci/src/abci/app/execution_result.rs puts actual_fees.total_base_fee() into ExecTxResult.gas_used for a successful execution.
  • rs-dapi receives ExecTxResult from Tenderdash but WaitForStateTransitionResultResponse returns only the proof (or owner_balance) and metadata.
  • rs-sdk TopUpIdentity::top_up_identity_* returns the balance only. rs-platform-wallet top_up_identity_with_funding, platform_wallet_top_up_identity_with_funding_signer and SwiftDashSDK ManagedPlatformWallet.topUpIdentityWithFunding pass that balance on.

Proposal

Return the credits the top-up added (or the fee it paid) next to the balance:

  1. dapi-grpc: a field on WaitForStateTransitionResultResponseV0 for the executed transition's fee.
  2. rs-dapi: fill it from ExecTxResult.gas_used.
  3. rs-sdk → rs-platform-wallet → FFI → SwiftDashSDK: return the credited amount with the balance (absent when the node does not send it).

Open points: whether the fee charged equals total_base_fee() exactly (user_fee_increase, refunds), and that the value is not covered by the GroveDB proof.

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