Document non-uniqueness of SetTopic IDs (#7579)

* Document non-uniqueness of SetTopic IDs

* More comments on WithUniqueTopic
This commit is contained in:
Keith Yeung
2023-08-07 09:13:36 -07:00
committed by GitHub
parent ed7a0b87eb
commit 0f90a667bd
3 changed files with 12 additions and 0 deletions
+4
View File
@@ -981,6 +981,10 @@ pub enum Instruction<Call> {
/// Set the Topic Register. /// Set the Topic Register.
/// ///
/// The 32-byte array identifier in the parameter is not guaranteed to be
/// unique; if such a property is desired, it is up to the code author to
/// enforce uniqueness.
///
/// Safety: No concerns. /// Safety: No concerns.
/// ///
/// Kind: *Instruction* /// Kind: *Instruction*
+3
View File
@@ -207,6 +207,9 @@ impl<
/// Sets the message ID to `t` using a `SetTopic(t)` in the last position if present. /// Sets the message ID to `t` using a `SetTopic(t)` in the last position if present.
/// ///
/// Note that the message ID does not necessarily have to be unique; it is the
/// sender's responsibility to ensure uniqueness.
///
/// Requires some inner barrier to pass on the rest of the message. /// Requires some inner barrier to pass on the rest of the message.
pub struct TrailingSetTopicAsId<InnerBarrier>(PhantomData<InnerBarrier>); pub struct TrailingSetTopicAsId<InnerBarrier>(PhantomData<InnerBarrier>);
impl<InnerBarrier: ShouldExecute> ShouldExecute for TrailingSetTopicAsId<InnerBarrier> { impl<InnerBarrier: ShouldExecute> ShouldExecute for TrailingSetTopicAsId<InnerBarrier> {
+5
View File
@@ -25,6 +25,11 @@ use xcm::prelude::*;
/// appends one to the message filled with a universally unique ID. This ID is returned from a /// appends one to the message filled with a universally unique ID. This ID is returned from a
/// successful `deliver`. /// successful `deliver`.
/// ///
/// If the message does already end with a `SetTopic` instruction, then it is the responsibility
/// of the code author to ensure that the ID supplied to `SetTopic` is universally unique. Due to
/// this property, consumers of the topic ID must be aware that a user-supplied ID may not be
/// unique.
///
/// This is designed to be at the top-level of any routers, since it will always mutate the /// This is designed to be at the top-level of any routers, since it will always mutate the
/// passed `message` reference into a `None`. Don't try to combine it within a tuple except as the /// passed `message` reference into a `None`. Don't try to combine it within a tuple except as the
/// last element. /// last element.