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

Configure Polkadot <> Kusama Bridge to Use Asset Conversion to Buy Execution #104

Open
joepetrowski opened this issue Jun 25, 2023 · 4 comments
Labels
I5-enhancement An additional feature request. T14-system_parachains This PR/Issue is related to system parachains. T15-bridges This PR/Issue is related to bridges.

Comments

@joepetrowski
Copy link
Contributor

At least initially, we expect the Polkadot<>Kusama bridge to maintain some assets on each side with which to buy execution. For example, we'd expect the Kusama Asset Hub (AH) to have some DOT in its sovereign account on Polkadot's AH, and then charge users extra KSM for transacting on Kusama's AH over the bridge to Polkadot's AH, where the XCM program would withdraw some DOT from its sovereign account to pay for execution locally.

This has some flaws, like ensuring that the correct additional amount is withdrawn on the Kusama side, and that it will be sufficient given the current weight-to-fee rate on Polkadot's AH, and the fact that this account would need to be occasionally topped up via governance.

By using asset conversion, the bridge could buy execution (accurately) in any asset it sends over, provided there is a pool for it (e.g. a pKSM <> DOT pair).

@joepetrowski joepetrowski transferred this issue from paritytech/cumulus Aug 24, 2023
@the-right-joyce the-right-joyce added I5-enhancement An additional feature request. T14-system_parachains This PR/Issue is related to system parachains. T15-bridges This PR/Issue is related to bridges. and removed J0-enhancement labels Aug 25, 2023
@acatangiu
Copy link
Contributor

acatangiu commented Sep 13, 2023

With https://kusama.subsquare.io/referenda/258 and https://polkadot.subsquare.io/referenda/122 we now have (k)DOT on Kusama AssetHub and (p)KSM on Polkadot AssetHub, both of which are marked as sufficient on their respective side. Meaning that fees and execution can be bought on either side with both DOT and KSM.

So we no longer need to manage (and periodically balance) these sovereign accounts of AHs on each respective side.

But, I believe we still need to use asset conversion (i.e. pKSM <> DOT and kDOT <> KSM pools) to figure out "the exchange rate" at which to spend non-native asset for buying execution on remote chain.

E.g.: Alice transfers 10 DOT from PAH (Polkadot AssetHub) to KAH (Kusama AssetHub) - and specifies that she wants to pay fees from transferred DOT - so Alice pays:

  1. 0.1 DOT for tx_fee on PAH
  2. buys X weight for execution of ExportMessage on PBH (Polkadot BridgeHub) - X weight on Polkadot -> 1 DOT (we have hardcoded exchange rate between weight and DOT on Polkadot)
  3. buys Y weight for XCM execution on target KAH - Y weight on Kusama -> ??? DOT (we know kusama_weight -> KSM conversion, but we don't know how much DOT to charge)

So, my guess is we'd use AssetConversion for #3, but don't know how/if we can hook that up to weight->asset calculator to make it "just work" for everyone.

@joepetrowski
Copy link
Contributor Author

I think ultimately we will need #606 to make that work. Asset Conversion can publish recent rates of selected assets (e.g. KSM, USDT, ETH, etc.) and the Bridge Hub could subscribe to those.

@acatangiu
Copy link
Contributor

acatangiu commented Sep 13, 2023

This is all concerning target AssetHub, not BridgeHub.

I spoke to @bkontur and have more detail/context on what happens at target AH:

On AssetHubs we configure new XCM Trader which uses this multiplier to convert weight->asset_amount based on the asset's Existential Deposit.

I guess this is ok(ish):

  • weight --static-foreign-asset-ED-based-ratio--> foreign-asset

but it'd be better if we could use AssetConversion here to do:

  • weight --static-native-asset-ED-based-ratio--> native-asset --dynamic-pool-ratio--> foreign-asset,

that way, all weight "costs" the same in native token, regardless of what is used to pay.

I think ultimately we will need #606 to make that work. Asset Conversion can publish recent rates of selected assets (e.g. KSM, USDT, ETH, etc.) and the Bridge Hub could subscribe to those.

Right now, we don't charge anything on target BH so we don't need this, but yes, we would use it if we start charging (possibly XCM HRMP delivery fee to target AH).

@acatangiu
Copy link
Contributor

Ok, so we have #105 exactly for what I described above.

I guess we can close this issue then. 👍

lexnv added a commit that referenced this issue Apr 3, 2024
* archive/call: Return a JSON-RPC object

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* archive/call: Adjust params

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust sudo_sessionKeys

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update src/api/archive_unstable_call.md

Co-authored-by: James Wilson <james@jsdw.me>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
jonathanudd pushed a commit to jonathanudd/polkadot-sdk that referenced this issue Apr 10, 2024
…aritytech#104)

* mute warnings from sub2sub module+relay

* cargo fmt --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request. T14-system_parachains This PR/Issue is related to system parachains. T15-bridges This PR/Issue is related to bridges.
Projects
None yet
Development

No branches or pull requests

3 participants