Fees for statemine transfers
I've been looking at transfers from parachains to statemine/t. The effects on bookkeeping are:
- Parachain.user balance decreases by
user_fee - Relaychain.ParaSovereign decreases by
user_fee - MinXcmFee - Relaychain.StatemintSovereign increases by
user_fee - MinXcmFee - RelayFees - Statemint.ParaSovereign gets a deposit from the teleport of
user_fee - MinXcmFee - RelayFees - StatemintFeesForTeleportMsg. - Statemint.ParaSovereign withdraws
MinXcmFee
I'm wondering about the correctness of the first two items. Every time you do a do a transfer, the imbalance between Relaychain.ParaSovereign and the total issuance on the parachain increases by MinXcmFee, essentially leaving the sovereign account with more balance than users on the parachain can withdraw. Is there a reason for this, or is this a bug?
This is due to the cross-chain transfer to statemine support #698 , which no better solution was found other than sending fees separately to Kusama and Statemine. The gap amount MinXcmFee between parachain sovereign account and parachain issuance goes to Statemin. It should be fine as Statemine.ParaSovereign + Kusama.ParaSovereign is still balanced with parachain total issuance.
It should be fine as
Statemine.ParaSovereign+Kusama.ParaSovereignis still balanced with parachain total issuance.
This would be the case if the destination of the teleport of the first message were to the user account, but that is not the case - the teleport is to Statemine.ParaSovereign. The amount teleported is supposed to be enough such that after the two messages, there is not a net decrease in Statemine.ParaSovereign.
Consider the case where Statemine.ParaSovereign is 0 before the xtokens call. Obviously it can not decrease further. The call will still succeed if the user is teleporting sufficient fees, but after both xcm messages have been processed, the result is:
- Kusama.ParaSovereign decrease by
user_fee - MinXcmFee - Statemine.ParaSovereign does not decrease
- Parachain.totalIssuance decreases by
user_fee
So an imbalance of MinXcmFee is created
Yeah what we have currently is just a workaround. The fee mechanism on Statemine/t is just very poor DX. Feel free to propose alternative solution if you have.