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

Add AllowTransferAndSwap Filter for pallet_xcm #2789

Conversation

apopiak
Copy link
Contributor

@apopiak apopiak commented Dec 22, 2023

As parachains we want to allow sending of XCMs that combine various transfer and swap instructions. The most flexible way of doing this is allowing pallet_xcm::execute for some subset of instructions. We have thus written an XcmExecuteFilter that allows some instructions (ClearOrigin | SetFeesMode | BuyExecution | ExchangeAsset | WithdrawAsset | TransferAsset | DepositAsset | ExpectAsset | InitiateReserveWithdraw | DepositReserveAsset | TransferReserveAsset) we consider necessary for the functionality but hard to exploit.
The filter further limits the amount of instructions and the maximum recursion depth to allow for deterministic weight of the filter itself.

We hope to establish this filter as a default so UIs can send XCMs to pallet_xcm for any parachain (that uses pallet_xcm and this filter).

Developed with @dmoka and @jak-pan for HydraDX.
We've been running the filter in production on Basilisk for a while.
See here for the original PR.

@apopiak apopiak requested a review from a team as a code owner December 22, 2023 10:52
@bkontur
Copy link
Contributor

bkontur commented Dec 22, 2023

cc @KiChjang @franciscoaguirre

@KiChjang
Copy link
Contributor

KiChjang commented Jan 1, 2024

First question: why is this implemented as a call filter rather than a barrier?

@apopiak
Copy link
Contributor Author

apopiak commented Mar 14, 2024

Sorry for the slow reply!

This is implemented as a call filter because we want to modify the filtering behavior of pallet_xcm, not the executor. The executor will execute these kinds of instructions just fine (or not, if the barrier is very strict).
By default pallet_xcm::execute is locked down tight in the ecosystem, tighter than the underlying barriers for the executor.

@bkchr
Copy link
Member

bkchr commented Jul 17, 2024

CC @franciscoaguirre @acatangiu

@acatangiu
Copy link
Contributor

@apopiak on Relay and System chains we've completely opened up the filters: polkadot-fellows/runtimes#285, polkadot-fellows/runtimes#261, polkadot-fellows/runtimes#345

So, the recommendation is for other parachains to do the same (assuming they're using recentish versions of the SDK that include mature, battle-tested XCM code and configs).

It's also obviously ok for parachains to configure more restrictive custom filters, but these would be parachain specific.

In this context, is the PR still relevant? Any reason I'm missing, that you'd want this custom filter to be part of the SDK, rather than runtime-specific?

@jak-pan
Copy link

jak-pan commented Jul 17, 2024

@apopiak on Relay and System chains we've completely opened up the filters: polkadot-fellows/runtimes#285, polkadot-fellows/runtimes#261, polkadot-fellows/runtimes#345

So, the recommendation is for other parachains to do the same (assuming they're using recentish versions of the SDK that include mature, battle-tested XCM code and configs).

It's also obviously ok for parachains to configure more restrictive custom filters, but these would be parachain specific.

In this context, is the PR still relevant? Any reason I'm missing, that you'd want this custom filter to be part of the SDK, rather than runtime-specific?

I think this PR is not relevant anymore given the facts stated above

@acatangiu acatangiu closed this Jul 17, 2024
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.

6 participants