XCM: Tools for uniquely referencing messages (#7234)

* Tools for unique topic references

* Formatting

* Naming

* Repot into routing.rs.

* More things done

* Universal Exporter supports topic-as-reference

* Some tests for the topic routing

* More tests

* Paid bridge tests

* Add message ID to sending events

* Formatting

* fix and integrate into test nets

* Move DenyThenTry and friend from Cumulus

* Append SetTopic rather than prepend

* Docs

* Docs

* Work with new ProcessMessage ID API

* Formatting

* Fix build

* Fixes

* Formatting

* Update xcm/xcm-builder/src/barriers.rs

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>

* Update xcm/xcm-builder/src/routing.rs

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>

* Docs

* Rename message_hash

* Formatting

* ".git/.scripts/commands/fmt/fmt.sh"

* Rename

* Another Rename

* ".git/.scripts/commands/fmt/fmt.sh"

* ".git/.scripts/commands/fmt/fmt.sh"

* Update xcm/xcm-builder/src/routing.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

---------

Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: command-bot <>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Gavin Wood
2023-05-25 07:57:32 +01:00
committed by GitHub
parent 28de4f1337
commit 85dfadff2c
29 changed files with 1305 additions and 552 deletions
+17 -9
View File
@@ -184,7 +184,7 @@ pub mod prelude {
NetworkId::{self, *},
OriginKind, Outcome, PalletInfo, Parent, ParentThen, PreparedMessage, QueryId,
QueryResponseInfo, Response, Result as XcmResult, SendError, SendResult, SendXcm,
Unwrappable,
Unwrappable, Weight,
WeightLimit::{self, *},
WildFungibility::{self, Fungible as WildFungible, NonFungible as WildNonFungible},
WildMultiAsset::{self, *},
@@ -337,19 +337,27 @@ impl TryFrom<OldWeightLimit> for WeightLimit {
/// Contextual data pertaining to a specific list of XCM instructions.
#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug)]
pub struct XcmContext {
/// The `MultiLocation` origin of the corresponding XCM.
/// The current value of the Origin register of the XCVM.
pub origin: Option<MultiLocation>,
/// The hash of the XCM.
pub message_hash: XcmHash,
/// The topic of the XCM.
/// The identity of the XCM; this may be a hash of its versioned encoding but could also be
/// a high-level identity set by an appropriate barrier.
pub message_id: XcmHash,
/// The current value of the Topic register of the XCVM.
pub topic: Option<[u8; 32]>,
}
impl XcmContext {
/// Constructor which sets the message hash to the supplied parameter and leaves the origin and
/// Constructor which sets the message ID to the supplied parameter and leaves the origin and
/// topic unset.
pub fn with_message_hash(message_hash: XcmHash) -> XcmContext {
XcmContext { origin: None, message_hash, topic: None }
#[deprecated = "Use `with_message_id` instead."]
pub fn with_message_hash(message_id: XcmHash) -> XcmContext {
XcmContext { origin: None, message_id, topic: None }
}
/// Constructor which sets the message ID to the supplied parameter and leaves the origin and
/// topic unset.
pub fn with_message_id(message_id: XcmHash) -> XcmContext {
XcmContext { origin: None, message_id, topic: None }
}
}
@@ -933,7 +941,7 @@ pub enum Instruction<Call> {
UnlockAsset { asset: MultiAsset, target: MultiLocation },
/// Asset (`asset`) has been locked on the `origin` system and may not be transferred. It may
/// only be unlocked with the receipt of the `UnlockAsset` instruction from this chain.
/// only be unlocked with the receipt of the `UnlockAsset` instruction from this chain.
///
/// - `asset`: The asset(s) which are now unlockable from this origin.
/// - `owner`: The owner of the asset on the chain in which it was locked. This may be a