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

Inbound queue v2 #3

Draft
wants to merge 45 commits into
base: outbound-queue-v2
Choose a base branch
from
Draft

Inbound queue v2 #3

wants to merge 45 commits into from

Conversation

yrong
Copy link
Owner

@yrong yrong commented Oct 18, 2024

No description provided.

@yrong yrong mentioned this pull request Oct 20, 2024
12 tasks
@yrong yrong changed the base branch from v2 to outbound-queue-v2 October 24, 2024 16:13
MAX_XCM_DECODE_DEPTH,
&mut message.xcm.as_ref(),
)
.map_err(|_| Error::<T>::InvalidPayload)?;

Choose a reason for hiding this comment

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

We should not fail on Invalid xcm. We should rather build the xcm payload without appending anything. This will allow the assets to get trapped on assethub.

&mut message.xcm.as_ref(),
)
.map_err(|_| Error::<T>::InvalidPayload)?;
let xcm: Xcm<()> = versioned_xcm.try_into().map_err(|_| <Error<T>>::InvalidPayload)?;

Choose a reason for hiding this comment

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

Same here. Any issues parsing the XCM should result in assets getting trapped on Asset Hub.

// Todo: Deposit fee(in Ether) to RewardLeger which should cover all of:
// T::RewardLeger::deposit(who, envelope.fee.into())?;
// a. The submit extrinsic cost on BH
// b. The delivery cost to AH

Choose a reason for hiding this comment

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

The xcm can be built here without the need for XCM v5 and we can re-do later when XCM v5 is ready.

You will need to parse the Assets in the ticket and build the following XCM to send to asset hub:

ReceiveTeleportedAsset(asset_hub_fees)
BuyExecution(fees: asset_hub_fees)
DescendOrigin(PalletInstance(inbound_queue_pallet_index))
UniversalOrigin(GlobalConsensus(network))
ReserveAssetDeposited(erc20_assets)    // from assets that do not have tokenId
WithdrawAsset(pna_assets)                      // from assets that do have tokenId
DescendOrigin(msg_sender)

You can then append the xcm from the payload to this base xcm. If the xcm payload fails to be parsed, append nothing and send to asset hub anyway, this will cause the assets to get trapped on asset hub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants