-
Notifications
You must be signed in to change notification settings - Fork 707
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
Interface to expose Call
enum structure from construct_runtime
for XCM Transact
callers
#813
Comments
Isn't this what |
Duplicated to the request I made more than a year ago: paritytech/substrate#8158 |
And maybe the proper solutions is polkadot-fellows/xcm-format#22 + PSPs? |
The example constructed for the xcm simulator in paritytech/polkadot#5598 regarding the origin of this issue was inspired by the Acala team shown here: |
Okay so I gave this some more thought, and the kinds of data that we really need is the following:
The pallet index is generated by What this then means is that we can simply modify the two macros and have them generate some sort of interface, and put these data into a new crate. Foreign runtimes can then simply import this newly auto-generated crate. Ideally, this crate will be generated and updated whenever there's a new release -- this would then allow foreign runtimes to stay up-to-date with the latest pallet indices of the XCM Transact recipient's runtime. |
I'm still curious as to whether |
I will repeat myself again: https://docs.rs/subxt-codegen/latest/subxt_codegen/ |
Just to note.. I have used in a test |
It would be much better if the runtime can simply produce artifacts of its own interface as part of its building process. Using an external tool like subxt to extract runtime metadata is pretty brittle and can quickly get out of date as it does not keep track of runtime upgrades. What seems to be the best solution to me is the ability for substrate-based chains to query other chains for their |
I do think that is a more robust solution when I look at it at face value. |
Why should you store the |
I'm not sure why this question is asked; it's akin to asking "why should we store the XCM version of another chain in the local chain state". We currently do so for versions because we have to figure out what the appropriate XCM version that we want to use; similarly, we should also then store a compressed version of another chain's Frankly speaking, we don't necessarily need to store the |
There is a huge difference. XCM needs to know the supported XCM version of the remote chain to send a XCM message in the correct format. For transact, XCM doesn't care on what the destination supports expects. It will not interpret or try to "correct" the transact message. The transact message is constructed in the upper layers, in the chain logic. Why should XCM even try to care what kind of bytes you want to send in transact? Maybe you are speaking with a none Substrate based chain that is expecting quite a different format for the message? If the runtime call format of the target chain changed, what would you do? A call that your pallet wants to execute requires a new argument? What will you do? Your pallet can not handle this 🤷 |
We obviously will key on the runtime version of the foreign runtime. Then it would simply check whether the versions match, and if not, we fail the transaction. It doesn't need to try and upgrade or downgrade your transaction. The only thing this is really protecting against is the change in pallet indices; for the other 2 pieces of data, we can already use ExpectPallet or QueryPallet in XCMv3 to first inquire about the expected version of the pallet. As such, we don't even need to store any of these data either; just the runtime version is enough. |
Giving my 2 cents:
Having the possibility to identify other chains pallet/extrinsics/types is important. An external tool could be combined with on-chain storage to allow updating those. I'm not sure a fully on-chain system could work. |
I agree with @KiChjang that if you just are storing the runtime version then it isnt so much effort it just works like versioning. Guaranteeing a fail would be nice because in the current paradigm failing is your best case scenario and worst case is something bad is happening and you dont even know it. |
The other solution to this would be to add an |
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
…h#813) * Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
* Nest some crates. * Alter command execution to make it easier to add new bridges. * Rename sub-dirs. * cargo fmt --all * Address clippy. * Update relays/substrate/src/rialto_millau/cli.rs Co-authored-by: Hernando Castano <[email protected]> Co-authored-by: Hernando Castano <[email protected]>
Right now, the way to construct a
Transact
XCM safely is to import the foreign chain's runtime crate and use itsCall
enum to encode/decode incoming/outgoing XCMTransact
instructions. This is obviously not a practical or scalable solution, since a runtime crate is pretty large in size, and pulling it in as a dependency is going to considerably bloat code sizes, not to mention elongate compilation times.What teams do nowadays instead is to have a local representation of the SCALE-encoded foreign
Call
enum. This is not ideal either since it can easily go out of sync with the foreign chain, which would makeTransact
instructions to the foreign fail.We'll need to create some kind of interface based on the
Call
enum without requiring devs to pull in an entire runtime crate.The text was updated successfully, but these errors were encountered: