paritytech / parity-bridges-common

Collection of Useful Bridge Building Tools 🏗️
GNU General Public License v3.0
270 stars 133 forks source link

[P-K Bridge] AssetHubs - create wrapped/derivate representations for KSM/DOT #2401

Closed bkontur closed 1 year ago

bkontur commented 1 year ago

We need to create ForeignAssets for wrappedKSM on AssetHubPolkadot and wrappedDOT on AssetHubKusama.

Options: (lets consider wrappedDOT on AssetHubKusama)

  1. use pallet_assets::force_create on Kusama/AssethubKusama governance call
     force_create(
         MultiLocation(parents: 2, X1(GlobalConsensus(Polkadot))),
         SOVEREIGN_ACCOUNT,
         is_sufficient=false,
         min_balance=?
     )
    • what SOVEREIGN_ACCOUNT -> SA_OF_ASSET_HUB_POLKADOT(MultiLocation(parents: 2, X2(GlobalConsensus(Polkadot), Parachain(1000))) or SA_OF_POLKADOT(MultiLocation(parents: 2, X1(GlobalConsensus(Polkadot))))
    • what min_balance ?
  2. use pallet_assets::create from Polkadot relaychain
     create(
         MultiLocation(parents: 2, X1(GlobalConsensus(Polkadot))),
         ADMIN_ACCOUNT,
         min_balance=?
     )
    • what ADMIN_ACCOUNT: SA of Polkadot relay chain or SA of AssetHubPolkadot?
    • what min_balance ?
    • this means to extend/add XCM bridge routing to polkadot runtime
  3. option: anything else because ForeignCreators wont work for MultiLocation::parent() and AssetHubPolkadot

TODOs

bkontur commented 1 year ago

@joepetrowski Joe, could you please, help with this?

joepetrowski commented 1 year ago

Yeah, HRMP channels should all be set up now.

I think we'd go the force_create route and actually set is_sufficient = true, at least for DOT on Kusama and perhaps also for KSM on Polkadot. min_balance can be lower on Kusama, perhaps Polkadot's Asset Hub's ED on Kusama (0.1 DOT), but we should find a similar value of Polkadot's ED for KSM on AHP.

bkontur commented 1 year ago

if we go with isSufficient=true on both sides, then we dont need (for KSM<>DOT) any hacks and customization for pallet_xcm like we tried here https://github.com/paritytech/polkadot/pull/7456

the only thing we need to fix is Trader and allow to pay fees from ForeignAssets instance, because now we allow only for TrustBased/Local instance:

type Trader = (
        UsingComponents<WeightToFee, KsmLocation, AccountId, Balances, ToStakingPot<Runtime>>,
        cumulus_primitives_utility::TakeFirstAssetTrader<
            AccountId,
            AssetFeeAsExistentialDepositMultiplierFeeCharger,
            TrustBackedAssetsConvertedConcreteId,
            Assets,
            cumulus_primitives_utility::XcmFeesTo32ByteAccount<
                FungiblesTransactor,
                AccountId,
                XcmAssetFeesReceiver,
            >,
        >,
    );
joepetrowski commented 1 year ago

Bonus then. We should use SwapFirstAssetTrader which solves this problem anyway https://github.com/paritytech/cumulus/pull/2854

joepetrowski commented 1 year ago

what SOVEREIGN_ACCOUNT ->

  • SA_OF_ASSET_HUB_POLKADOT(MultiLocation(parents: 2, X2(GlobalConsensus(Polkadot), Parachain(1000))) or
  • SA_OF_POLKADOT(MultiLocation(parents: 2, X1(GlobalConsensus(Polkadot))))

This sounds more like a bridge implementation question. What would the bridge pass over as its origin? Since on Polkadot's local Asset Hub we call DOT { parents: 1, interior: Here }, IMO the second option is better.

Edit: Yes, let's go with the second option. As this is used for things like freeze, set_metadata, set_min_balance, etc., these calls should come from the governance location, not the reserve location, of the asset.

acatangiu commented 1 year ago

Governance proposals live: