Struct staging_xcm_builder::WithComputedOrigin
source · pub struct WithComputedOrigin<InnerBarrier, LocalUniversal, MaxPrefixes>(/* private fields */);Expand description
A derivative barrier, which scans the first MaxPrefixes instructions for origin-alterers and
then evaluates should_execute of the InnerBarrier based on the remaining instructions and
the newly computed origin.
This effectively allows for the possibility of distinguishing an origin which is acting as a router for its derivative locations (or as a bridge for a remote location) and an origin which is actually trying to send a message for itself. In the former case, the message will be prefixed with origin-mutating instructions.
Any barriers which should be interpreted based on the computed origin rather than the original message origin should be subject to this. This is the case for most barriers since the effective origin is generally more important than the routing origin. Any other barriers, and especially those which should be interpreted only the routing origin should not be subject to this.
E.g.
type MyBarrier = (
TakeWeightCredit,
AllowTopLevelPaidExecutionFrom<DirectCustomerLocations>,
WithComputedOrigin<(
AllowTopLevelPaidExecutionFrom<DerivativeCustomerLocations>,
AllowUnpaidExecutionFrom<ParentLocation>,
AllowSubscriptionsFrom<AllowedSubscribers>,
AllowKnownQueryResponses<TheResponseHandler>,
)>,
);
In the above example, AllowUnpaidExecutionFrom appears once underneath
WithComputedOrigin. This is in order to distinguish between messages which are notionally
from a derivative location of ParentLocation but that just happened to be sent via
ParentLocaction rather than messages that were sent by the parent.
Similarly AllowTopLevelPaidExecutionFrom appears twice: once inside of WithComputedOrigin
where we provide the list of origins which are derivative origins, and then secondly outside
of WithComputedOrigin where we provide the list of locations which are direct origins. It’s
reasonable for these lists to be merged into one and that used both inside and out.
Finally, we see AllowSubscriptionsFrom and AllowKnownQueryResponses are both inside of
WithComputedOrigin. This means that if a message begins with origin-mutating instructions,
then it must be the finally computed origin which we accept subscriptions or expect a query
response from. For example, even if an origin appeared in the AllowedSubscribers list, we
would ignore this rule if it began with origin mutators and they changed the origin to something
which was not on the list.
Trait Implementations§
source§impl<InnerBarrier: ShouldExecute, LocalUniversal: Get<InteriorMultiLocation>, MaxPrefixes: Get<u32>> ShouldExecute for WithComputedOrigin<InnerBarrier, LocalUniversal, MaxPrefixes>
impl<InnerBarrier: ShouldExecute, LocalUniversal: Get<InteriorMultiLocation>, MaxPrefixes: Get<u32>> ShouldExecute for WithComputedOrigin<InnerBarrier, LocalUniversal, MaxPrefixes>
source§fn should_execute<Call>(
origin: &MultiLocation,
instructions: &mut [Instruction<Call>],
max_weight: Weight,
properties: &mut Properties
) -> Result<(), ProcessMessageError>
fn should_execute<Call>( origin: &MultiLocation, instructions: &mut [Instruction<Call>], max_weight: Weight, properties: &mut Properties ) -> Result<(), ProcessMessageError>
Auto Trait Implementations§
impl<InnerBarrier, LocalUniversal, MaxPrefixes> RefUnwindSafe for WithComputedOrigin<InnerBarrier, LocalUniversal, MaxPrefixes>
impl<InnerBarrier, LocalUniversal, MaxPrefixes> Send for WithComputedOrigin<InnerBarrier, LocalUniversal, MaxPrefixes>
impl<InnerBarrier, LocalUniversal, MaxPrefixes> Sync for WithComputedOrigin<InnerBarrier, LocalUniversal, MaxPrefixes>
impl<InnerBarrier, LocalUniversal, MaxPrefixes> Unpin for WithComputedOrigin<InnerBarrier, LocalUniversal, MaxPrefixes>
impl<InnerBarrier, LocalUniversal, MaxPrefixes> UnwindSafe for WithComputedOrigin<InnerBarrier, LocalUniversal, MaxPrefixes>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.