apps icon indicating copy to clipboard operation
apps copied to clipboard

Transferable balance is incorrect

Open michalisFr opened this issue 1 year ago • 7 comments

  • I'm submitting a ...
  • [X] Bug report
  • [ ] Feature request
  • [ ] Support request
  • [ ] Other
  • What is the current behavior and expected behavior?

Transferable balance seems to be calculated incorrectly. After the merging of this PR, reducible is calculated as indicated here.

It seems transferable is calculated with the deprecated: transferable = free - reserved - max(feeFrozen, miscFrozen)

  • What is the motivation for changing the behavior?

Display transferable balance properly.

Perhaps free balance should also be displayed because it can be used for holds (aka reserves) even if transferable is insufficient.

  • Please tell us about your environment:
  • Version: apps v0.132.2-134

  • Environment:

    • [ ] Node.js
    • [X] Browser
    • [ ] Other (limited support for other environments)
  • Language:

    • [ ] JavaScript
    • [ ] TypeScript (include tsc --version)
    • [ ] Other

michalisFr avatar Oct 27 '23 12:10 michalisFr

Hello @IkerAlus & @TarikGul ,

Today, I encountered a critical issue while attempting to submit a proposal. After creating a pre-image, I noticed that my transferrable balance was showing as 0 DOT.

In an attempt to rectify this, I initiated a transaction of 20 DOT from another wallet to my identified wallet. However, even after completing the transaction, my transferrable balance remains unchanged. Subscan indicates that the transaction was successfully processed, as seen here.

Captura de pantalla 2024-04-19 122056

This issue is particularly urgent as I urgently need to submit two proposals on Polkassembly and create and sign child bounties within the next 10 days. Unfortunately, my account is currently frozen, preventing me from proceeding with these crucial tasks.

Thanks!

Albertpolkadot avatar Apr 19 '24 10:04 Albertpolkadot

Hi @Albertpolkadot I fail to understand, why is the fact that the transferable balance is not showed correctly in the UI preventing you from submitting your transactions as usual?

Also, Subscan reports that the transferable balance is 0 DOT for this account too:

Screenshot 2024-04-19 at 11 45 59

IkerAlus avatar Apr 19 '24 10:04 IkerAlus

Hi @IkerAlus,

Yes, this is the problem, I sent 20 Dots to my wallet, but I can't see these 20 DOTS that they should be free...

image

Albertpolkadot avatar Apr 19 '24 10:04 Albertpolkadot

@Albertpolkadot Hey I am looking into this now. Can you post a picture of the UI where it says your transferable balance is zero. I am currently trying to trace down the root of this and that would help a lot.

TarikGul avatar Apr 19 '24 13:04 TarikGul

The transferrable balance is derived here: https://github.com/polkadot-js/api/blob/master/packages/api-derive/src/balances/all.ts#L59

TarikGul avatar Apr 19 '24 13:04 TarikGul

@Albertpolkadot To add to what @IkerAlus is saying as well, even if the displayed transferable is incorrect in the UI, that shouldn't stop you from sending an extrinsic through the extrinsic page since the on chain data is still correct.

TarikGul avatar Apr 19 '24 13:04 TarikGul

@TarikGul @Albertpolkadot @IkerAlus

The fee_payment pallet hasn't migrated to fungibles yet AFAIK, so although the funds are there (based on the new calculation) the pallet thinks the reducible balance is zero because it calculates it with the previous formula: transferable = free - max(frozen, reserved). From what I see, this PR was merged 3 weeks ago, so it should be in the next runtime upgrade.

So, although according to the balances pallet the transferable isn't zero, if the UI is updated before the updated fee_payment pallet is in the runtime, transactions might still fail with the insufficient_funds error.

A list of all pallets that need migration is here, but I don't know how updated the tracking is.

What you Albert can do, if you want to transfer those funds out, is deposit enough DOT to bring the free balance above zero based on the previous calculation, and then you'll be able to transfer all transferable balance with a transfer_all call.

michalisFr avatar Apr 22 '24 07:04 michalisFr

This has been fixed in the API level and will be fixed in apps this week.

TarikGul avatar Aug 18 '24 23:08 TarikGul