-
Notifications
You must be signed in to change notification settings - Fork 788
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
contracts: XCM support #121
Comments
hi guys 👋 how will XCM over SCs work in terms of:
cc @KiChjang |
We add a new host function that allows sending XCM functions to a ink_env::send_xcm(dest: MultiLocation, bytes: &[u8]) -> Result<(), ErrorCode>; Whenever a contract is the target of an XCM message it gets called and the gas meter is set according to the
The I expect it to be done like this:
We can buffer all XCM messages and only emit them at the end if the contract call did not revert. |
Integrate XCM: Discussion 2021-11-16
|
Persisting some of our discussions: #[ink(xcm_receive, max_gas_consumed = 50_000)]
pub fn ink_xcm_receive(src: MultiLocation, msg: &[u8]) {
if msg[0] == 1 {
// expensive computation
} else {
// cheap computation
}
} The Note: Gas is a synonym for Weight. How a contract would be called:
Necessary follow-up issues:
Test use-cases for our MVP:
|
Persisting this here: It's still unclear how the UI would display our MVP in a meaningful way. |
We will do the MVP as a chain extension in a separate repository to get around the fact that we can't depend on polkadot from substrate. This will be useful for that: paritytech/substrate#11751 |
Delayed to next month because it needs to be merged into |
@athei |
Because it is unclear who pays for for the execution when there is no extrinsic attached to the execution. Even without the problem of fees we have the problem that the callback will be called from It seems to me as a much simpler design. |
* Add descriptions for folder structure + node * Beef up descriptions of project components * Fix list formatting * Add note about nightly Rust * Update README.md Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update README.md Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Reword Tomek's currency-exchange suggestion * Add link to Substrate's installation guide Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
XCM host functions are implemented in pallet-revive. We will enable them at a later time, though. |
The Vision
Contracts should be able to execute and send arbitrary XCM messages. This will allow contracts to participate in the wider ecosystem. A common use case would be to make use of assets on statemint.
The Plan
A while ago I created a chain extension to support executing, sending and receiving XCM messages from a contract: https://github.com/paritytech/pallet-contracts-xcm
This is a prototype but already outlines all the features we need:
ink_xcm_receive
. This solves the weight problems around receiving replies.It doesn't do this in a secure way, though. It is a prototype. For example, it doesn't charge storage deposits for the reply id and reply buffer.
It is a chain extension rather than a core API solely because of technical reasons: It depends on the XCM crates which are part of the
polkadot
repo. However, pallet-contracts is in thesubstrate
repository on whichpolkadot
depends. Thereforepallet-contracts
can't depend on XCM as this would be a circle. As a workaround we placed the code into another repository. The only way to do that is a chain extension. The real implementation should be bundled withpallet-contracts
once we have the monorepo. It still needs to be optional as some chains might decide not to implement it. Hence it might make sense to keep it a chain extension rather than a core API.Open Questions
If you want to help us out and contribute to this issue, in this section you can find open questions and tasks where we would appreciate any input.
Here you can find the board with specific sub-tasks to this milestone:
<Link to your project's view>
The text was updated successfully, but these errors were encountered: