polkadot-js / apps

Basic Polkadot/Substrate UI for interacting with a Polkadot and Substrate node. This is the main user-facing application, allowing access to all features available on Substrate chains.
https://dotapps.io
Apache License 2.0
1.74k stars 1.53k forks source link

Transferable balance is incorrect #9988

Closed michalisFr closed 1 month ago

michalisFr commented 10 months ago

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)

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.

Albertpolkadot commented 5 months ago

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!

IkerAlus commented 5 months ago

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
Albertpolkadot commented 5 months ago

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

TarikGul commented 5 months ago

@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 commented 5 months ago

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

TarikGul commented 5 months ago

@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.

michalisFr commented 5 months ago

@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.

TarikGul commented 1 month ago

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

polkadot-js-bot commented 3 weeks ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.