A common problem which XCM users have is the need for their chain to be able to construct and send calls which the receiving system can interpret when using Xcm::Transact
. When interacting with a single chain, this is not a large issue, but becomes one when interfacing with many chains.
The desired goal is to have a predictable and common API surface for remote systems with respect to:
- Which operations they support
- How to construct
Xcm::Transact
packets that can achieve those operations.
To that end, previous suggestions have been to:
- Add more specific messages to XCM for use-cases like swapping, LP provisioning
- Adding more pallet-specific tooling to XCM for targeting specific pallets on a remote chain, without being aware of their particular index.
In fact, we can do better by changing our mindset around the Xcm::Transact
message with a concept we refer to as āDialectsā (thanks for the name, @karel).
The rough idea is for chains to change the way they configure the XCM pallet differently by providing a RuntimeCall
type which is a wrapper around the raw call and the supported dialects.
In effect, thisād look something like this, plus versioning logic:
enum SupportedInboundXcmTransactions {
Raw(Call), // direct `Call` to be executed on-chain
DialectX(DialectXTransaction),
DialectY(DialectYTransaction),
}
@shawntabrizi had some thoughts on a more specific format for this data structure, with versioning.
The receiving chain is free to determine how to handle DialectX
and DialectY
however it likes, mapping onto specific pallets in a way that can change between runtime upgrades, while sending chains get a predictable API interface.
We should also discuss discoverability of dialects from across chains - possibly with a similar āpub/subā system as is used to negotiate XCM versions themselves across chains in XCMv3.
This opens some space for community standards to emerge around the best way of doing common activities. For instance, the community could create a āDeFiā dialect that includes swaps, LP provisioning, or other common DeFi requirements. EVM calls, Oracles, Vaults are all also possibilities.
rel: Explore the idea of XCM dialects Ā· Issue #6013 Ā· paritytech/polkadot Ā· GitHub
Thanks to Shawn, Brainjar, Karel, Keith for the initial discussion leading to this forum post.