Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frame_support::traits::tokens::fungible user's funds may stuck #328

Closed
stepanLav opened this issue May 24, 2024 · 14 comments · Fixed by #332
Closed

frame_support::traits::tokens::fungible user's funds may stuck #328

stepanLav opened this issue May 24, 2024 · 14 comments · Fixed by #332

Comments

@stepanLav
Copy link

stepanLav commented May 24, 2024

Description:

After introducing new balance logic - paritytech/polkadot-sdk#1833 (comment)
there is a case, when user's funds may stuck, that happens when user transfer from his account with reserved and lock balances.

Case:

  1. Make account with balance - 5 WND
  2. Create reserve balance - 3 WND (create 3 pure proxy)
  3. Create locked balance 1 WND (bond 1 WND)
  4. Transfer 1 WND to any account

Actual result:
User can't sign operations in some pallets, it will fall down with error

proxy - https://westend.subscan.io/extrinsic/20967814-2
staking - https://westend.subscan.io/extrinsic/20967935-2
multisig - https://westend.subscan.io/extrinsic/20967870-2

but he still can transfer some assets from his account (submitted operation after all falls above):
https://westend.subscan.io/extrinsic/20967957-2

Example of that account:
https://westend.subscan.io/account/5EWrvLtq8wdpMTaKHMVNf7tarU7dpfU8Bi1QxRmMaZY2cVHf

Pallets where would be great to get support of new fee deduction:

  • staking
  • multisig
  • proxy
  • convictionvoting(all related to governance)
@stepanLav stepanLav changed the title frame_support::traits::tokens::fungible can't pay fee if free less than frozen frame_support::traits::tokens::fungible user's funds may stuck May 24, 2024
@muharem
Copy link
Contributor

muharem commented May 27, 2024

@stepanLav do I understand it right, the fee payments with new fungibles implementation fixes this?
if you confirm I can try to get it with the next patch release. Westend Asset Hub fee payments should be already working with fungibles implementation right now.

@muharem
Copy link
Contributor

muharem commented May 27, 2024

@stepanLav basically in the use case you have described a user that have a free balance cannot pay the fee? do you have many reports from users? Please give a bit more on the impact.

@stepanLav
Copy link
Author

stepanLav commented May 27, 2024

@stepanLav basically in the use case you have described a user that have a free balance cannot pay the fee? do you have many reports from users? Please give a bit more on the impact.

I dived deeper and looks like on the Westend Relaychain it does not reproduce anymore, case itself connected to a problem, when different pallets calculate available part of balance in different ways, some use T::Currency, some - T::Fungibles. As a result, where Fungibles are used, we can pay a fee from accounts with free < max(`reserved`, `frozen`)), but where Currency is used, we can't.

it is still reproduced on the Kusama network, so on the account with that balance:

{
  nonce: 4
  consumers: 2
  providers: 1
  sufficients: 0
  data: {
    free: 229,809,526,241
    reserved: 668,033,331,300
    frozen: 300,000,000,000
    flags: 170,141,183,460,469,231,731,687,303,715,884,105,728
  }
}

I can't do anything, every time I get ExtrinsicStatus:: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low, In that case I need to top up my account in order to get free > frozen to bypass fee verification

@muharem
Copy link
Contributor

muharem commented May 27, 2024

probably exact same issue as described here - paritytech/polkadot-sdk#1833

@muharem
Copy link
Contributor

muharem commented May 27, 2024

I will try to get it into #316

@Juanma0x
Copy link

@stepanLav basically in the use case you have described a user that have a free balance cannot pay the fee? do you have many reports from users? Please give a bit more on the impact.

Several users have referred similar problems to the Web3 Foundation support team. Some public examples:

It was my understanding that the issue was fixed with paritytech/polkadot-sdk#2292 in Polkadot-SDK v1.11.0, so it'll be fixed in the runtime whenever Polkadot-SDK v.1.11.0 is adopted, but I might be wrong.

@muharem
Copy link
Contributor

muharem commented May 30, 2024

@stepanLav basically in the use case you have described a user that have a free balance cannot pay the fee? do you have many reports from users? Please give a bit more on the impact.

Several users have referred similar problems to the Web3 Foundation support team. Some public examples:

It was my understanding that the issue was fixed with paritytech/polkadot-sdk#2292 in Polkadot-SDK v1.11.0, so it'll be fixed in the runtime whenever Polkadot-SDK v.1.11.0 is adopted, but I might be wrong.

Yes, but I am trying to get it into the next release as a patch with this PR - #332

fellowship-merge-bot bot pushed a commit that referenced this issue May 31, 2024
)

Fixes: #328

Transaction payments work via new `fungible` traits implementation

---------

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
@esh2n
Copy link

esh2n commented Jun 27, 2024

@stepanLav

Two APIs are no longer executable since the timing of this modification to Westend.

Has anything changed when creating transactions?

  • TransactionPaymentApi_query_info
  • payment_queryFeeDetails

@muharem
Copy link
Contributor

muharem commented Jun 27, 2024

which API you mean? TransactionPaymentApi_query_info and payment_queryFeeDetails ? what's the errori?

the issue described by @stepanLav should be solved with 1.2.5, which is ready to be upgraded now for Polkadot and System Chains

@niso1985
Copy link

niso1985 commented Jul 1, 2024

@muharem @stepanLav
I am in the same situation.
And I am experiencing this situation for the first time on mainnet and I have no information at all and I am confused.
I got it to work right away.
What should I do?
cf. https://substrate.stackexchange.com/questions/11668/suddenly-transactionpaymentapi-query-info-is-generating-wasm-errors-at-block-hei

% curl -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "method": "payment_queryInfo",
  "params": ["0x4d028400dc79f8c551a63d2e0cae3b48d8f5546a01519435547549e2ddafff03db69d6b802ef7e99d4c10478bd1eeb7c25fa8f67f803bb29c749a433e60b63afa49c9cb508505385adb52faff90c06d9d7df23084a86f3c73b039c575d9d93f648e0c76c12019500590f000500005b319adeae0b1813e257ee19b008ee502bc759583ed4fe7ddaf7427afd7c0dac0b88779361c812", "0xfefca3ef82ad35f84cf3fcaaf6dccb2768a3050de00d40821a03e06df2a418f1"],
  "id": 1
}' https://rpc.polkadot.io/
{"jsonrpc":"2.0","error":{"code":1,"message":"Unable to query dispatch info.","data":"Execution failed: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed\nWASM backtrace:\nerror while executing at wasm backtrace:\n    0: 0x63a3 - <unknown>!rust_begin_unwind\n    1: 0x2eb7 - <unknown>!core::panicking::panic_fmt::hbb5a6b42001bdfec\n    2: 0x53ea58 - <unknown>!TransactionPaymentApi_query_info"},"id":1}

@muharem
Copy link
Contributor

muharem commented Jul 1, 2024

@esh2n @niso1985 There is a new signed extension that should be included in the transaction. Most likely, its absence is the reason you are getting that error.
#337

@muharem
Copy link
Contributor

muharem commented Jul 1, 2024

@stepanLav the issue should be fixed now

@niso1985
Copy link

niso1985 commented Jul 1, 2024

@muharem Thank you. You're a big help.

@stepanLav
Copy link
Author

@muharem Thank you!
I've checked Kusama and Polkadot and now there is no problem to pay fee in governance\proxy\staking pallets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants