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

More feedbacks and questions #3

Closed
xlc opened this issue Jul 1, 2020 · 2 comments
Closed

More feedbacks and questions #3

xlc opened this issue Jul 1, 2020 · 2 comments

Comments

@xlc
Copy link
Contributor

xlc commented Jul 1, 2020

Another round of feedbacks and questions.


message: Xcm: The message; opaque unless version is known and well-defined.

One issue of SCALE codec is that you will need to know the schema first in order to be able to decode it. This means opaque message cannot be handled unless the message length is known. There should be a length prefix somewhere just to provide proper future compatibility support so it is actually possible to parse Vec<XCM> that contains future version.


AssetInstruction Instruction Types
QueryHolding
Initiates a Balances message to some destination with the given query_id for each of the assets given.

What is a Balances message?

DepositAsset
Deposit all assets in the Holding Account into a given destination account.

Does this deposit all the assets or only the assets specified in asset parameter?


MultiLocation
Type 0: Null

Self instead of Null?


MultiNetwork

How to represent a parachain network? e.g. use version 1 "aca" for Acala or assuming Acala have parachain ID of 2 so it will be "dot/2"?

Or in other words, do we want to put parachains under the namespace of relaychain or parachains needs its own network_id?


Examples
Foreign account exchange

ExchangeAsset(*, 21 BTC)

So this attempts to use all the assets (42 DOT) to exchange for 21 BTC. But what happen is DOT/BTC is 0.51? Does user get 21.42 BTC or user spend 41.177 DOT to get 21 BTC? Is this up to implementation to decide?

What happen if exchange rate is 0.49? How to indicate failure and how to handle failure?

QueryHolding(../H)

What is the purpose of this? DepositAsset is already able to deposit all the assets in holding account.


This provides examples of how does exchanges interact with XCM. But what about other use cases? e.g. Staking

How does one chain dispatch a dispatchable call on another chain?

@jak-pan
Copy link

jak-pan commented Jul 2, 2020

I think that second value in ExchangeAsset should be the minimal amount of assets received for the transaction to go through. Thats most in sync with general exchange implementations. You generally cannot guarantee the price since it can slip before the trade takes place.

@gavofyork
Copy link
Contributor

Another round of feedbacks and questions.

message: Xcm: The message; opaque unless version is known and well-defined.

One issue of SCALE codec is that you will need to know the schema first in order to be able to decode it. This means opaque message cannot be handled unless the message length is known. There should be a length prefix somewhere just to provide proper future compatibility support so it is actually possible to parse Vec<XCM> that contains future version.

For now we're assuming that all message passing systems already pass pre-encoded messages (i.e. Vec<u8>s) around. We can introduce this encapulation if/when that proves to be false.

AssetInstruction Instruction Types
QueryHolding
Initiates a Balances message to some destination with the given query_id for each of the assets given.

What is a Balances message?

Xcm::Balances: It's an information message conveying a Vec<MultiAsset>.

DepositAsset
Deposit all assets in the Holding Account into a given destination account.

Does this deposit all the assets or only the assets specified in asset parameter?

Only those assets. Now updated.

MultiLocation
Type 0: Null

Self instead of Null?

That would be a reserved word in Rust.

MultiNetwork

How to represent a parachain network? e.g. use version 1 "aca" for Acala or assuming Acala have parachain ID of 2 so it will be "dot/2"?

Or in other words, do we want to put parachains under the namespace of relaychain or parachains needs its own network_id?

I would not expect to see "dot/2". Parachains will tend to use their own NetworkId(s).

Examples
Foreign account exchange

ExchangeAsset(*, 21 BTC)

So this attempts to use all the assets (42 DOT) to exchange for 21 BTC. But what happen is DOT/BTC is 0.51? Does user get 21.42 BTC or user spend 41.177 DOT to get 21 BTC? Is this up to implementation to decide?

I would expect that the user gets 21.42 BTC, however under the current spec, both would be acceptable outcomes.

What happen if exchange rate is 0.49? How to indicate failure and how to handle failure?

Failure would be recorded through an event on the recipient chain. Data return paths (and the fee structure they imply) are a complex topic and out of scope for this initial version.

QueryHolding(../H)

What is the purpose of this? DepositAsset is already able to deposit all the assets in holding account.

The purpose is to initiate a return message so that the sender can see what remains in the holding account.

This provides examples of how does exchanges interact with XCM. But what about other use cases? e.g. Staking

Stkaing, governance and various other use-cases are not supported at present. If needed, then there's always Xcm::transact. Happy to see proposals for how Xcm can be extended with new message types for these use-cases though.

How does one chain dispatch a dispatchable call on another chain?

Xcm::Transact

@xlc xlc closed this as completed Sep 16, 2020
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

No branches or pull requests

3 participants