novasamatech / nova-spektr

Nova Spektr — All-in-one Polkadot desktop wallet supporting multisigs, staking, light clients, and more
https://novaspektr.io
Apache License 2.0
40 stars 16 forks source link

Add support delivery fee for XCMs #1552

Open pgolovkin opened 8 months ago

pgolovkin commented 8 months ago

Fix on Android for delivery fee: A message sending chain now can deduct delivery fee. In recent Kusama upgrade exponential delivery fee is introduced calculated using formula:

F * (B + encoded_msg_len * M)

where F is a factor that depends on the queue load: dmp.deliveryFactor, xcmpQueue.deliveryFactor

B - base fee constant in xcm config: https://github.com/polkadot-fellows/runtimes/blob/v1.1.0/relay/kusama/src/xcm_config.rs#L116C12-L116C27

M - TransactionByteFee constant in the config: https://github.com/polkadot-fellows/runtimes/blob/v1.1.0/relay/kusama/src/lib.rs#L414

For example, if one is sending KSM: Kusama ➝ Asset Hub. It will now pay:

fee for teleport extrinsic on Kusama delivery fee on Kusama (by xcm pallet) xcm execution fee on Asset Hub

Note that xcm-pallet widthraws fee not from the holding but from the sender's balance before sending message to the destination chain.

Android fix PR https://github.com/novasamatech/nova-wallet-android/pull/1411/files

Should be done after ED validation implementation.

pgolovkin commented 3 weeks ago

Part of #2167