Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Deposit fee to beneficiary #137

Closed
wants to merge 11 commits into from
Closed

Conversation

yrong
Copy link

@yrong yrong commented Apr 10, 2024

No description provided.

@yrong yrong marked this pull request as ready for review April 10, 2024 02:38
@claravanstaden
Copy link
Collaborator

So where did the fees go before this PR? To the AH sovereign account? And now it is going to the transfer beneficiary?

// Deposit asset to beneficiary.
DepositAsset { assets: Definite(asset.into()), beneficiary },
// Deposit both asset and fees to beneficiary.
DepositAsset { assets: Wild(AllCounted(2u32)), beneficiary },
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why AllCounted instead of All?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alistair-singh
Copy link

So where did the fees go before this PR? To the AH sovereign account? And now it is going to the transfer beneficiary?

Previously the remaining DOT was trapped in pallet-xcm.

@alistair-singh
Copy link

So basically there is no explicit calculation/configuration variable that we can set the ED to when transferring? We need to calculate the fee for sendToken with the ED taking into account?

@yrong
Copy link
Author

yrong commented Apr 11, 2024

So basically there is no explicit calculation/configuration variable that we can set the ED to when transferring? We need to calculate the fee for sendToken with the ED taking into account?

As I mentioned in notion page, since the ED is only 0.01 DOT on AssetHub, a tiny extra assetHubReserveTransferFee will just cover that.

Copy link

@alistair-singh alistair-singh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment on lines +299 to +300
println!("key:{:?}", hex::encode(&key));
println!("value:{:?}", hex::encode(&value));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to leave these in?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Deposit asset to beneficiary.
DepositAsset { assets: Definite(asset.into()), beneficiary },
// Deposit both asset and fees to beneficiary.
DepositAsset { assets: Wild(All), beneficiary },

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces a new failure mode and extra burden on integrations. The failure it is trying to fix is that it will create the account on the destination parachain. However this now places a burden on the destination parachain to store excess DOT in one of their pallets, if it is not configured to than the deposit will fail and assets will be trapped.

So we probably shouldn't do this on the destination chain portion. Only on asset hub.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point 👍

@yrong In general, I am very conservative with changes to our XCM messages, as they can have undefined behavior, depending on the destination parachain.

I think as a practice, before we write any code we should write a short RFC document explaining the change, and detailing any potential changes in behavior that could be problematic.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its also hard to review, without seeing the complete messages that are forwarded to AssetHub and the final dest para,

So the RFC doc should include pseudocode describing the full messages.

Copy link
Author

@yrong yrong Apr 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that make sense.

Usually I check the xcm message from log of emulated test with log level specified(e.g. RUST_LOG=xcm=trace) but it's not easy for others to review/understand.

Sorry for that, let me add the document with the xcm messages forwarded.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7e0ddaa for the fix.

Copy link
Author

@yrong yrong Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

@yrong yrong Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, the initial intention is just for deposit the excess DOT to beneficiary on destination chain, because it's always not good to leave the fees trapped somewhere instead of send it to the user.

Also it seems better to encourage the end user to send enough destination_fee on Ethereum to ensure the xcm will be success on substrate, and we just let them know the extra fees will be finally refunded and no worry.

But consider the side effects above we only apply this change on asset hub and not do this on the destination chain portion.

@yrong yrong requested a review from alistair-singh April 16, 2024 09:29
github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this pull request Apr 26, 2024
Just the upper-stream for
Snowfork#137 and more context
there.

---------

Co-authored-by: Clara van Staden <[email protected]>
Co-authored-by: Adrian Catangiu <[email protected]>
@yrong
Copy link
Author

yrong commented Apr 29, 2024

Closed in favor of paritytech#4175

@yrong yrong closed this Apr 29, 2024
Morganamilo pushed a commit to paritytech/polkadot-sdk that referenced this pull request May 2, 2024
Just the upper-stream for
Snowfork#137 and more context
there.

---------

Co-authored-by: Clara van Staden <[email protected]>
Co-authored-by: Adrian Catangiu <[email protected]>
TarekkMA pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Aug 2, 2024
…#4175)

Just the upper-stream for
Snowfork#137 and more context
there.

---------

Co-authored-by: Clara van Staden <[email protected]>
Co-authored-by: Adrian Catangiu <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants