This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Incorrect ordering of fees and tips in Transaction Payment #8854
Labels
U2-some_time_soon
Issue is worth doing soon.
It appears that the ordering of transaction fees and tips is incorrect when passing to the on_unbalanceds function:
substrate/frame/transaction-payment/src/payment.rs
Lines 122 to 124 in 965be9f
The split function returns the split amount first, and the remainder second
substrate/frame/balances/src/lib.rs
Lines 1183 to 1189 in 965be9f
This means that what is passed to on_unbalanceds is [tip, fees] instead of [fees, tip] as the comments specify.
This implementation of DealWithFees that splits fees between block producer and Treasury illustrates the issue, as the comments clearly specify that the first item is believed to be the fees.
substrate/bin/node/runtime/src/lib.rs
Lines 141 to 155 in 965be9f
This bug can be found in the Polkadot Mainnet.
Here is an example of a transfer without tips:
https://polkadot.js.org/apps/#/explorer/query/0x0218a64f98f808d654f9113cd1feeb70d66e1fb02742b2ee43df33d3b88922e7
The totality of the transaction fee is deposited in the block producer's account.
Here is an example of a transfer with a tip:
https://polkadot.js.org/apps/#/explorer/query/0xf0d74cc96794b6ef3ff3836ff115bff18fefb9132790ae033d5d5014a24cb102
The totality of the transaction fee + 20% of the tip is deposited in the block producer's account.
80% of the tip is deposited into the Treasury account.
The text was updated successfully, but these errors were encountered: