Skip to content
Snippets Groups Projects
Commit 0f90a667 authored by Keith Yeung's avatar Keith Yeung Committed by GitHub
Browse files

Document non-uniqueness of SetTopic IDs (#7579)

* Document non-uniqueness of SetTopic IDs

* More comments on WithUniqueTopic
parent ed7a0b87
No related merge requests found
......@@ -981,6 +981,10 @@ pub enum Instruction<Call> {
/// 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.
///
/// Kind: *Instruction*
......
......@@ -207,6 +207,9 @@ impl<
/// 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.
pub struct TrailingSetTopicAsId<InnerBarrier>(PhantomData<InnerBarrier>);
impl<InnerBarrier: ShouldExecute> ShouldExecute for TrailingSetTopicAsId<InnerBarrier> {
......
......@@ -25,6 +25,11 @@ use xcm::prelude::*;
/// appends one to the message filled with a universally unique ID. This ID is returned from a
/// 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
/// passed `message` reference into a `None`. Don't try to combine it within a tuple except as the
/// last element.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment