Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@gavofyork
Copy link
Member

No description provided.

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Aug 29, 2020
@gavofyork gavofyork marked this pull request as draft August 29, 2020 07:49
@gavofyork gavofyork added A3-in_progress Pull request is in progress. No review needed at this stage. and removed A0-please_review Pull request needs code review. labels Aug 29, 2020
}

#[derive(Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug)]
pub enum Junction {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't match spec?

}

#[derive(Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug)]
pub enum MultiAsset {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

potentially need to update spec here too

Copy link
Contributor

@xlc xlc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current XCM implementation will failed to decode messages contains future version.
Do we want better future compatibility? i.e. Better handle VersionedXXX, decode it into some Unknown(OpaqueMessage) type. That also requires the messages to be length prefixed.

AccountIndex64 { network: MultiNetwork, #[codec(compact)] index: u64 },
AccountKey20 { network: MultiNetwork, key: [u8; 20] },
/// An instanced Pallet on a Frame-based chain.
PalletInstance { id: u8 },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The is the pallet index right? The index in construct_runtime? Not the Instance number for Instantiable pallets?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the index from construct_runtime. Will see if I can rename it.

pub enum AssetInstance {
Undefined,
Index8(u8),
Index16 { #[codec(compact)] id: u16 },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want to use compact encoding for u16, it can only save up to one byte and can use two more bytes in some cases.

}

#[derive(Clone, Eq, PartialEq, Encode, Decode)]
pub enum Ai {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use the full name here? i.e. AssetInstruction

AbstractNonFungible { class: Vec<u8>, instance: AssetInstance },
ConcreteFungible { id: MultiLocation, #[codec(compact)] amount: u128 },
ConcreteNonFungible { class: MultiLocation, instance: AssetInstance },
Each(Vec<MultiAsset>),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to first one to match with Ai::Each

Balances { query_id: Vec<u8>, assets: Vec<MultiAsset> },
Transact { origin_type: MultiOrigin, call: Vec<u8> },
// these won't be staying here for long. only v0 parachains with HRMP.
ForwardToParachain { id: u32, inner: Box<VersionedXcm> },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it is possible to set explicit index here to 250 so remove those in later version won't leave a hole

Copy link
Contributor

@shaunxw shaunxw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some feedback while integrating XCM v0 to ORML.

Decimal conversion.

We might need a mechanism to handle decimal differences between chains, like DOT in Acala is 18. It might not be a problem for sending XCM, as the appropriate amounts could be set on different part of XCM while building it. (Not 100% sure, it might affect holding in some cases if different amounts in different parts?) But while executing DMP, currently there is no way to identify if it's from a chain with different decimals.

A straightforward solution might be to introduce origin parameter in deposit_asset and withdraw_asset in TransactAsset traits. So that amounts could be adjusted based on different origins.

More error handling

There is no detailed error info if something goes wrong in CurrencyAdapter. Maybe we could add a customizable variant into xcm::traits::Error, to contain details, instead of returning Error::Undefined.

Xcm/Effect execution events

It would be helpful to have events indicating what Xcm/Effects got executed.

fn deposit_event() = default;

#[weight = 10]
fn execute(origin, xcm: VersionedXcm) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make execute public so it could be called by other modules?

One use case is in orml-xtokens, which serves as an adapter module, to adapt dispatchable calls like transfer_to_relay_chain to an xcm and execute it.

https://github.com/open-web3-stack/open-runtime-module-library/blob/da34a35112f564baf31df93beed9675c6a9ec3a0/xtokens/src/lib.rs#L92-L103

@pepyakin pepyakin mentioned this pull request Oct 5, 2020
@acatangiu acatangiu deleted the gav-xcmp branch December 12, 2022 10:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A3-in_progress Pull request is in progress. No review needed at this stage.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants