From b5dc04feb66b7811ed7bb0f804a1ec896cf00526 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 11 Mar 2021 11:04:47 +0100 Subject: [PATCH 1/7] Dispatch stuff --- README.md | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/README.md b/README.md index 7c0be78..be84355 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,16 @@ Where message `type` must be one of: - `4`: `Transact` - `5`: `RelayTo` - `6`: `RelayedFrom` +- `7`: `HrmpNewChannelOpenRequest` +- `8`: `HrmpChannelAccepted` +- `9`: `HrmpChannelClosing` +- `10`: `HrmpInitOpenChannel` +- `11`: `HrmpAcceptOpenChannel` +- `12`: `HrmpCloseChannel` +- `13`: `QueryPallet` +- `14`: `PalletInfo` +- `15`: `Dispatch` +- `16`: `DispatchOutcome` Within XCM, there is an internal datatype `Order`, which encodes an operation on the holding account. It is defined as: @@ -173,6 +183,73 @@ Kind: *Trusted Indication*. Errors: +### `QueryPallet` + +Query the existence of a particular pallet type. + +- `name: Vec`: The name of the pallet to query. +- `query_id`: The value to make the returned message identifiable with this query. + +Returns: A honestly populated `PalletInfo` to the origin. + +Safety: No concerns. + +Kind: *Instruction* + +Errors: + +### `PalletInfo` + +Provide information on the existence of a particular pallet type. + +- `query_id` The identifier of the query which caused this message to be sent. +- `pallets: Vec<(u32, (u32, u32, u32))>`: The index/version of each of the pallets whose name matches the name in the according `QueryPallet` message. + +Safety: No concerns. + +Kind: *Trusted Indication* + +Errors: + +### `Dispatch` + +Dispatch a call into a pallet in the Frame system. This provides a means of ensuring that the pallet continues to exist with a known version. + +- `origin_type`: The means of expressing the message origin as a dispatch origin. +- `name: Vec`: The name of the pallet to which to dispatch a message. +- `major_minor: (u32, u32)`: The major and minor version of the pallet. The major version must be equal and the minor version of the pallet must be at least as great. +- `pallet_index: u32`: The index of the pallet to be called. +- `call_index: u32`: The index of the dispatchable to be called. +- `params: Vec`: The encoded parameters of the dispatchable. +- `query_id`: The value to make the returned message identifiable with this query. + +Returns: `DispatchDone` or `DispatchFail` to origin. + +Safety: No concerns. + +Kind: *Instruction* + +Errors: + +### `DispatchOutcome` + +Provide information on the outcome of a previous `Dispatch` message. + +- `query_id` The identifier of the query which caused this message to be sent. +- `error: Result, DispatchError>`: If `Err` then the dispatch was not possible and the error is given. If `Ok`, then the dispatch was made and the inner value expresses the error with which the dispatch resulted: if `None`, then it succeeded. + +Safety: No concerns. + +Kind: *Trusted Indication* + +Errors: + +#### `DispatchError` + +`u8` enumeration: + +- `0x00: Pallet of the correct version not found` + ## `Order` Types ### `Null` From bf2107a3f4ab8f0d7db6a876f4327ed173913d75 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 5 Oct 2021 12:12:12 +0200 Subject: [PATCH 2/7] Update draft for v2 --- README.md | 120 +++++++++++++++++++----------------------------------- 1 file changed, 43 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index aea763c..6199a6e 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,8 @@ The instructions, in order, are: - `Trap` - `SubscribeVersion` - `UnsubscribeVersion` +- `QueryPallet` +- `Dispatch` ### Notes on terminology @@ -291,6 +293,8 @@ The `Response` type is used to express information content in the `QueryResponse - `Assets { assets: MultiAssets } = 1`: Some assets. - `ExecutionResult { result: Result<(), (u32, Error)> } = 2`: An error (or not), equivalent to the type of value contained in the Error Register. - `Version { version: Compact } = 3`: An XCM version. +- `PalletsInfo { info: Vec<(u32, Vec, Vec, (u32, u32, u32))> } = 4`: The index, instance name, pallet name and version of some pallets. +- `DispatchResult { maybe_error: Option } = 5`: The error of a dispatch attempt, or `None` if the dispatch executed without error. ### `TransferAsset` @@ -412,83 +416,6 @@ Immediately report the contents of the Error Register to the given destination v A `QueryResponse` message of type `ExecutionOutcome` is sent to `destination` with the given `query_id` and the outcome of the XCM. -### `QueryPallet` - -Query the existence of a particular pallet type. - -- `name: Vec`: The name of the pallet to query. -- `query_id`: The value to make the returned message identifiable with this query. - -Returns: A honestly populated `PalletInfo` to the origin. - -Safety: No concerns. - -Kind: *Instruction* - -Errors: - -### `PalletInfo` - -Provide information on the existence of a particular pallet type. - -- `query_id` The identifier of the query which caused this message to be sent. -- `pallets: Vec<(u32, (u32, u32, u32))>`: The index/version of each of the pallets whose name matches the name in the according `QueryPallet` message. - -Safety: No concerns. - -Kind: *Trusted Indication* - -Errors: - -### `Dispatch` - -Dispatch a call into a pallet in the Frame system. This provides a means of ensuring that the pallet continues to exist with a known version. - -- `origin_type`: The means of expressing the message origin as a dispatch origin. -- `name: Vec`: The name of the pallet to which to dispatch a message. -- `major_minor: (u32, u32)`: The major and minor version of the pallet. The major version must be equal and the minor version of the pallet must be at least as great. -- `pallet_index: u32`: The index of the pallet to be called. -- `call_index: u32`: The index of the dispatchable to be called. -- `params: Vec`: The encoded parameters of the dispatchable. -- `query_id`: The value to make the returned message identifiable with this query. - -Returns: `DispatchDone` or `DispatchFail` to origin. - -Safety: No concerns. - -Kind: *Instruction* - -Errors: - -### `DispatchOutcome` - -Provide information on the outcome of a previous `Dispatch` message. - -- `query_id` The identifier of the query which caused this message to be sent. -- `error: Result, DispatchError>`: If `Err` then the dispatch was not possible and the error is given. If `Ok`, then the dispatch was made and the inner value expresses the error with which the dispatch resulted: if `None`, then it succeeded. - -Safety: No concerns. - -Kind: *Trusted Indication* - -Errors: - -#### `DispatchError` - -`u8` enumeration: - -- `0x00: Pallet of the correct version not found` - -Operands: - -- `query_id: QueryId`: The value to be used for the `query_id` field of the `QueryResponse` message. -- `destination: MultiLocation`: The location to where the `QueryResponse` message should be sent. -- `max_response_weight: Weight`: The value to be used for the `max_weight` field of the `QueryResponse` message. - -Kind: *Instruction* - -Errors: *Fallible*. - ### `DepositAsset` Subtract the asset(s) (`assets`) from Holding and deposit on-chain equivalent assets under the ownership of `beneficiary`. @@ -673,12 +600,50 @@ Operands: Kind: *Instruction* +Errors: *Fallible*. + ### `UnsubscribeVersion` Cancel the effect of a previous `SubscribeVersion` instruction from Origin. Kind: *Instruction* +Errors: *Fallible*. + +### `QueryPallet` + +Query the existence of a particular pallet type. + +- `name: Vec`: The name of the pallet to query. +- `query_id`: The value to make the returned message identifiable with this query. +- `max_response_weight: Weight`: The value to be used for the `max_weight` field of the `QueryResponse` message. + +Sends a `QueryResponse` to Origin whose data field `PalletsInfo` containing the information of all pallets on the local chain whose name is equal to `name`. This is empty in the case that the local chain is not based on Substrate Frame. + +Safety: No concerns. + +Kind: *Instruction* + +Errors: _Fallible_. + +### `Dispatch` + +Dispatch a call into a pallet in the Frame system. This provides a means of ensuring that the pallet continues to exist with a known version. + +- `origin_type`: The means of expressing the message origin as a dispatch origin. +- `name: Vec`: The name of the pallet to which to dispatch a message. +- `major_minor: (Compact, Compact)`: The major and minor version of the pallet. The major version must be equal and the minor version of the pallet must be at least as great. +- `pallet_index: Compact`: The index of the pallet to be called. +- `call_index: Compact`: The index of the dispatchable to be called. +- `params: Vec`: The encoded parameters of the dispatchable. +- `query_id: Option<(MultiLocation, QueryId, Weight)>`: If present, then a `QueryResponse` whose `query_id` and `max_weight` are the given `QueryId`and `Weight` values is sent to the given `MultiLocation` value with a `DispatchResult` response corresponding to the error status of the "inner" dispatch. This only happens if the dispatch was actually made - if an error happened prior to dispatch, then the Error Register is set and the operation aborted as usual. + +Safety: No concerns. + +Kind: *Instruction* + +Errors: *Fallible*. + ## **6** Universal Asset Identifiers *Note on versioning:* This describes the `MultiAsset` (and associates) as used in XCM version of this document, and its version is strictly implied by the XCM it is used within. If it is necessary to form a `MultiAsset` value is used _outside_ of an XCM (where its version cannot be inferred) then the version-aware `VersionedMultiAsset` should be used instead, exactly analogous to how `Xcm` relates to `VersionedXcm`. @@ -877,3 +842,4 @@ Within XCM it is necessary to communicate some problem encountered while executi - `NotHoldingFees = 19`: Used by `BuyExecution` when the Holding Register does not contain payable fees. - `TooExpensive = 20`: Used by `BuyExecution` when the fees declared to purchase weight are insufficient. - `Trap(u64) = 21`: Used by the `Trap` instruction to force an error intentionally. Its code is included. +- `IncorrectVersion = 22`: Used by the `Dispatch` instruction when pallet of the correct version is not found. From 9ea0d65e6a86a1d9385c0b061b1d2d4caf4640cf Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 6 Oct 2021 17:27:58 +0200 Subject: [PATCH 3/7] Replace code --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 6199a6e..6ce82b0 100644 --- a/README.md +++ b/README.md @@ -416,6 +416,16 @@ Immediately report the contents of the Error Register to the given destination v A `QueryResponse` message of type `ExecutionOutcome` is sent to `destination` with the given `query_id` and the outcome of the XCM. +Operands: + +- `query_id: QueryId`: The value to be used for the `query_id` field of the `QueryResponse` message. +- `destination: MultiLocation`: The location to where the `QueryResponse` message should be sent. +- `max_response_weight: Weight`: The value to be used for the `max_weight` field of the `QueryResponse` message. + +Kind: *Instruction* + +Errors: *Fallible*. + ### `DepositAsset` Subtract the asset(s) (`assets`) from Holding and deposit on-chain equivalent assets under the ownership of `beneficiary`. From 6d4b5d1fece4e9c7c0a5eb22331b7254ad8f3783 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 22 Oct 2021 18:34:50 +0200 Subject: [PATCH 4/7] v3 stuff --- README.md | 148 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 106 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 95aeeb2..75594bd 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ The registers are named: - *Holding* - *Surplus Weight* - *Refunded Weight* +- *Transact Status* ### **3.1** Programme @@ -159,6 +160,12 @@ Of type `u64`, initialized to `0`. Expresses the portion of Surplus Weight which has been refunded. Not used on XCM platforms which do not require payment for execution. +### **3.10** Transact Status + +Of type `Option>`, initialized to `None`. + +Expresses the outcome of the most recent dispatch made by the `Transact` operation. + ## **4** Basic XCVM Operation The XCVM operates as a fetch-dispatch loop common in state machines. The steps of the loop are: @@ -239,7 +246,7 @@ Operands: Kind: *Instruction*. -Errors: *Fallible*. +Errors: *Fallible* ### `ReserveAssetDeposited` @@ -253,7 +260,7 @@ Kind: *Trusted Indication*. Trust: Origin must be trusted to act as a reserve for `assets`. -Errors: *Fallible*. +Errors: *Fallible* ### `ReceiveTeleportedAsset` @@ -267,7 +274,7 @@ Kind: *Trusted Indication*. Trust: Origin must be trusted to have removed the `assets` as a consequence of sending this message. -Errors: *Fallible*. +Errors: *Fallible* ### `QueryResponse` @@ -281,7 +288,7 @@ Operands: Kind: *Information*. -Errors: *Fallible*. +Errors: *Fallible* Weight: Weight estimation may utilise `max_weight` which may lead to an increase in Surplus Weight Register at run-time. @@ -293,7 +300,7 @@ The `Response` type is used to express information content in the `QueryResponse - `Assets { assets: MultiAssets } = 1`: Some assets. - `ExecutionResult { result: Result<(), (u32, Error)> } = 2`: An error (or not), equivalent to the type of value contained in the Error Register. - `Version { version: Compact } = 3`: An XCM version. -- `PalletsInfo { info: Vec<(u32, Vec, Vec, (u32, u32, u32))> } = 4`: The index, instance name, pallet name and version of some pallets. +- `PalletsInfo { info: Vec } = 4`: The information relating to a number of pallets. - `DispatchResult { maybe_error: Option } = 5`: The error of a dispatch attempt, or `None` if the dispatch executed without error. ### `TransferAsset` @@ -307,7 +314,7 @@ Operands: Kind: *Instruction*. -Errors: *Fallible*. +Errors: *Fallible* ### `TransferReserveAsset` @@ -323,7 +330,7 @@ Operands: Kind: *Instruction*. -Errors: *Fallible*. +Errors: *Fallible* ### `Transact` @@ -333,14 +340,15 @@ by the kind of origin `origin_type`. Operands: - `origin_type: OriginKind`: The means of expressing the message origin as a dispatch origin. -- `max_weight: Weight`: The maximum amount of weight to expend while dispatching `call`. If dispatch requires more weight then an error will be thrown. If dispatch requires less weight, then Surplus Weight Register may increase. +- `require_weight_at_most: Weight`: The maximum amount of weight to expend while dispatching `call`. If dispatch requires more weight then an error will be thrown. If dispatch requires less weight, then Surplus Weight Register may increase. - `call: Vec`: The encoded transaction to be applied. +- `query_id: Option`: If present, then a `QueryResponse` constructed according to the provided `QueryResponseInfo` should be sent with a `DispatchResult` response corresponding to the error status of the "inner" dispatch. This only happens if the dispatch was actually made - if an error happened prior to dispatch, then the Error Register is set and the operation aborted as usual. Kind: *Instruction*. -Errors: *Fallible*. +Errors: *Fallible* -Weight: Weight estimation may utilise `max_weight` which may lead to an increase in Surplus Weight Register at run-time. +Weight: Weight estimation may utilise `require_weight_at_most` which may lead to an increase in Surplus Weight Register at run-time. ### `HrmpNewChannelOpenRequest` @@ -369,7 +377,7 @@ Safety: The message should originate directly from the Relay-chain. Kind: *System Notification* -Errors: *Fallible*. +Errors: *Fallible* ### `HrmpChannelClosing` @@ -385,7 +393,7 @@ Safety: The message should originate directly from the Relay-chain. Kind: *System Notification* -Errors: *Fallible*. +Errors: *Fallible* ### `ClearOrigin` @@ -395,7 +403,7 @@ This may be used by the XCM author to ensure that later instructions cannot comm Kind: *Instruction*. -Errors: *Infallible*. +Errors: *Infallible* ### `DescendOrigin` @@ -407,7 +415,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `ReportError` @@ -424,7 +432,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `DepositAsset` @@ -438,7 +446,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `DepositReserveAsset` @@ -455,7 +463,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `ExchangeAsset` @@ -468,7 +476,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `InitiateReserveWithdraw` @@ -482,7 +490,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `InitiateTeleport` @@ -498,7 +506,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `ReportHolding` @@ -513,7 +521,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `BuyExecution` @@ -526,7 +534,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `RefundSurplus` @@ -534,7 +542,7 @@ Increase Refunded Weight Register to the value of Surplus Weight Register. Attem Kind: *Instruction* -Errors: *Infallible*. +Errors: *Fallible* ### `SetErrorHandler` @@ -546,7 +554,7 @@ Operands: Kind: *Instruction* -Errors: *Infallible*. +Errors: *Infallible* Weight: The estimated weight of this instruction must include the estimated weight of `error_handler`. At run-time, Surplus Weight Register should be increased by the estimated weight of the Error Handler prior to being changed. @@ -560,7 +568,7 @@ Operands: Kind: *Instruction* -Errors: *Infallible*. +Errors: *Infallible* Weight: The estimated weight of this instruction must include the estimated weight of `appendix`. At run-time, Surplus Weight Register should be increased by the estimated weight of the Appendix prior to being changed. @@ -570,7 +578,7 @@ Clear the Error Register. Kind: *Instruction* -Errors: *Infallible*. +Errors: *Infallible* ### `ClaimAsset` @@ -583,7 +591,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `Trap` @@ -595,7 +603,7 @@ Operands: Kind: *Instruction* -Errors: *Always*. +Errors: *Always* ### `SubscribeVersion` @@ -610,7 +618,7 @@ Operands: Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `UnsubscribeVersion` @@ -618,7 +626,7 @@ Cancel the effect of a previous `SubscribeVersion` instruction from Origin. Kind: *Instruction* -Errors: *Fallible*. +Errors: *Fallible* ### `BurnAsset(MultiAssets)` @@ -681,7 +689,7 @@ Errors: Query the existence of a particular pallet type. - `name: Vec`: The name of the pallet to query. -- `query_id`: The value to make the returned message identifiable with this query. +- `query_id: QueryId`: The value to make the returned message identifiable with this query. - `max_response_weight: Weight`: The value to be used for the `max_weight` field of the `QueryResponse` message. Sends a `QueryResponse` to Origin whose data field `PalletsInfo` containing the information of all pallets on the local chain whose name is equal to `name`. This is empty in the case that the local chain is not based on Substrate Frame. @@ -690,25 +698,81 @@ Safety: No concerns. Kind: *Instruction* -Errors: _Fallible_. +Errors: *Fallible* -### `Dispatch` +### `ExpectPallet` -Dispatch a call into a pallet in the Frame system. This provides a means of ensuring that the pallet continues to exist with a known version. +Ensure that a particular pallet with a particular version exists. -- `origin_type`: The means of expressing the message origin as a dispatch origin. -- `name: Vec`: The name of the pallet to which to dispatch a message. -- `major_minor: (Compact, Compact)`: The major and minor version of the pallet. The major version must be equal and the minor version of the pallet must be at least as great. -- `pallet_index: Compact`: The index of the pallet to be called. -- `call_index: Compact`: The index of the dispatchable to be called. -- `params: Vec`: The encoded parameters of the dispatchable. -- `query_id: Option<(MultiLocation, QueryId, Weight)>`: If present, then a `QueryResponse` whose `query_id` and `max_weight` are the given `QueryId`and `Weight` values is sent to the given `MultiLocation` value with a `DispatchResult` response corresponding to the error status of the "inner" dispatch. This only happens if the dispatch was actually made - if an error happened prior to dispatch, then the Error Register is set and the operation aborted as usual. +- `index: Compact`: The index which identifies the pallet. An error if no pallet exists at this index. +- `name: Vec`: Name which must be equal to the name of the pallet. +- `module_name: Vec`: Module name which must be equal to the name of the module in which the pallet exists. +- `crate_major: Compact`: Version number which must be equal to the major version of the crate which implements the pallet. +- `min_crate_minor: Compact`: Version number which must be at most the minor version of the crate which implements the pallet. Safety: No concerns. Kind: *Instruction* -Errors: *Fallible*. +Errors: + +- `ExpectationFalse`: In case any of the expectations are broken. + +### `ReportTransactStatus` + +Send a `QueryResponse` message containing the value of the Transact Status Register to some +destination. + +- `query_response_info: QueryResponseInfo`: The information needed for constructing and sending the + `QueryResponse` message. + +Safety: No concerns. + +Kind: *Instruction* + +Errors: *Fallible* + +### `ClearTransactStatus` + +Set the Transact Status Register to its default, cleared, value. + +Safety: No concerns. + +Kind: *Instruction* + +Errors: *Infallible* + +### Auxiliary Data-types + +#### `PalletInfo` + +Information regarding an instance of a pallet within a chain. Encoded as the tuple of fields: + +- `index: Compact`: The index of the pallet instance. +- `name: Vec`: The name given to the pallet instance. +- `module_name: Vec`: The module name in which the pallet exists. If it exists at the top-level of a crate then this will be the crate's name. +- `crate_major: Compact`: The major version of the crate which implements the pallet. +- `crate_minor: Compact`: The minor version of the crate which implements the pallet. +- `crate_patch: Compact`: The patch version of the crate which implements the pallet. + +#### `OriginKind` + +An identifier for a type of calling origin. + +Encoded as the tagged union of: + +- `Native = 0`: Origin should be the native dispatch origin representation for the sender in the local runtime framework. For Cumulus/Frame chains this is the `Parachain` or `Relay` origin if coming from a chain, though there may be others if the `MultiLocation` XCM origin has a primary/native dispatch origin form. +- `SovereignAccount = 1`: Origin should be the standard account-based origin with the sovereign account of the sender. For Cumulus/Frame chains, this is the `Signed` origin. +- `Superuser = 2`: Origin should be the super-user. For Cumulus/Frame chains, this is the `Root` origin. This will not usually be an available option. +- `Xcm = 3`: Origin should be interpreted as an XCM native origin and the `MultiLocation` should be encoded directly in the dispatch origin unchanged. For Cumulus/Frame chains, this will be the `pallet_xcm::Origin::Xcm` type. + +#### `QueryResponseInfo` + +Information needed to determine how a `QueryResponse` message should be constructed and sent. Encoded as the tuple of fields: + +- `destination: MultiLocation`: The destination to which the query response message should be send. +- `query_id: QueryId`: The `query_id` field of the `QueryResponse` message. +- `max_weight: Weight`: The `max_weight` field of the `QueryResponse` message. ## **6** Universal Asset Identifiers From 0b6ff693095b03246bd32ebca3ee396e9199d73e Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 22 Oct 2021 18:39:28 +0200 Subject: [PATCH 5/7] max_assets and Counted --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 75594bd..ed6569d 100644 --- a/README.md +++ b/README.md @@ -244,7 +244,7 @@ Operands: - `assets: MultiAssets`: The asset(s) to be removed; must be owned by Origin. -Kind: *Instruction*. +Kind: *Instruction* Errors: *Fallible* @@ -312,7 +312,7 @@ Operands: - `assets: MultiAssetFilter`: The asset(s) to be withdrawn. - `beneficiary`: The new owner for the assets. -Kind: *Instruction*. +Kind: *Instruction* Errors: *Fallible* @@ -328,7 +328,7 @@ Operands: - `destination: MultiLocation`: The location whose sovereign account will own the assets and thus the effective beneficiary for the assets and the notification target for the reserve asset deposit message. - `xcm: Xcm`: The instructions that should follow the `ReserveAssetDeposited` instruction, which is sent onwards to `destination`. -Kind: *Instruction*. +Kind: *Instruction* Errors: *Fallible* @@ -339,12 +339,12 @@ by the kind of origin `origin_type`. Operands: -- `origin_type: OriginKind`: The means of expressing the message origin as a dispatch origin. +- `origin_kind: OriginKind`: The means of expressing the message origin as a dispatch origin. - `require_weight_at_most: Weight`: The maximum amount of weight to expend while dispatching `call`. If dispatch requires more weight then an error will be thrown. If dispatch requires less weight, then Surplus Weight Register may increase. - `call: Vec`: The encoded transaction to be applied. - `query_id: Option`: If present, then a `QueryResponse` constructed according to the provided `QueryResponseInfo` should be sent with a `DispatchResult` response corresponding to the error status of the "inner" dispatch. This only happens if the dispatch was actually made - if an error happened prior to dispatch, then the Error Register is set and the operation aborted as usual. -Kind: *Instruction*. +Kind: *Instruction* Errors: *Fallible* @@ -401,7 +401,7 @@ Clear the Origin Register. This may be used by the XCM author to ensure that later instructions cannot command the authority of the Original Origin (e.g. if they are being relayed from an untrusted source, as often the case with `ReserveAssetDeposited`). -Kind: *Instruction*. +Kind: *Instruction* Errors: *Infallible* @@ -441,7 +441,6 @@ Subtract the asset(s) (`assets`) from Holding and deposit on-chain equivalent as Operands: - `assets: MultiAssetFilter`: The asset(s) to remove from the Holding Register. -- `max_assets: Compact`: The maximum number of unique assets/asset instances to remove from the Holding Register. Only the first `max_assets` assets/instances of those matched by `assets` will be removed, prioritized under standard asset ordering. Any others will remain in holding. - `beneficiary: MultiLocation`: The new owner for the assets. Kind: *Instruction* @@ -457,7 +456,6 @@ Send an onward XCM message to `destination` of `ReserveAssetDeposited` with the Operands: - `assets: MultiAssetFilter`: The asset(s) to remove from the Holding Register. -- `max_assets: Compact`: The maximum number of unique assets/asset instances to remove from the Holding Register. Only the first `max_assets` assets/instances of those matched by `assets` will be removed, prioritized under standard asset ordering. Any others will remain in holding. - `destination: MultiLocation`: The location whose sovereign account will own the assets and thus the effective beneficiary for the assets and the notification target for the reserve asset deposit message. - `xcm: Xcm`: The orders that should follow the `ReserveAssetDeposited` instruction which is sent onwards to `destination`. From 0f9bb83483398c39ad608fdad68e89aac4e410b4 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 22 Oct 2021 18:39:48 +0200 Subject: [PATCH 6/7] max_assets and Counted --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ed6569d..35c0890 100644 --- a/README.md +++ b/README.md @@ -836,6 +836,8 @@ A `WildMultiAsset` value is represented by the SCALE-encoded tagged union with t - `All = 0`: Matches for all assets. - `AllOf = 1 { class: AssetId, fun: WildFungibility }`: Matches for any assets which match the given `class` and fungibility (`fun`). +- `AllCounted = 2 { count: Compact }`: Matches for the first `count` assets, when placed under standard asset ordering. +- `AllOfCounted = 3 { class: AssetId, fun: WildFungibility, count: Compact }`: Matches for the first `count` (under standard asset ordering) of any assets which match the given `class` and fungibility (`fun`). A `MultiAssetFilter` value is represented by the SCALE-encoded tagged union with two variants: From 0a154927ac6824a51e89788b7a7f3685de60e25e Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 22 Oct 2021 18:57:33 +0200 Subject: [PATCH 7/7] Other small changes --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 35c0890..f70d4b9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Polkadot Cross-Consensus Message (XCM) Format +# Cross-Consensus Message (XCM) Format **Version 3, in-progress.** **Authors: Gavin Wood.** -This document details the message format for Polkadot-based message passing between chains. It describes the formal data format, any environmental data which may be additionally required and the corresponding meaning of the datagrams. +This document details the message format for message passing between differing chains and consensus systems. It describes the formal data format, any environmental data which may be required and the corresponding meaning of the datagrams. ## **1** Background @@ -22,6 +22,8 @@ Polkadot has three main transport systems for passing messages between chains al - **UMP** *Upward Message Passing* message passing from a parachain to the Relay-chain. - **DMP** *Downward Message Passing* message passing from the Relay-chain to a parachain. +While XCM was created with an acute need from within the Polkadot ecosystem, it is never the less designed to be of utility beyond wht might be termed the purely Polkadot ecosystem and rather more broadly in the general consensus, crypto and blockchain industry. + ### **1.1** XCM Communication Model XCM is designed around four 'A's: