Skip to content

Commit

Permalink
fix pallet-xcm authorized aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
acatangiu committed Nov 6, 2024
1 parent c29fc5d commit e84293f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions polkadot/xcm/pallet-xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,7 @@ pub mod pallet {
) -> DispatchResult {
let origin: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?;
let aliaser: Location = (*aliaser).try_into().map_err(|()| Error::<T>::BadVersion)?;
tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin, ?aliaser);
ensure!(origin != aliaser, Error::<T>::BadLocation);
let v_origin = VersionedLocation::from(origin);
let v_aliaser = VersionedLocation::from(aliaser);
Expand All @@ -1490,6 +1491,7 @@ pub mod pallet {
) -> DispatchResult {
let origin: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?;
let to_remove: Location = (*aliaser).try_into().map_err(|()| Error::<T>::BadVersion)?;
tracing::debug!(target: "xcm::pallet_xcm::add_authorized_alias", ?origin, ?to_remove);
ensure!(origin != to_remove, Error::<T>::BadLocation);
let v_origin = VersionedLocation::from(origin);
let v_to_remove = VersionedLocation::from(to_remove);
Expand Down Expand Up @@ -3515,16 +3517,10 @@ impl<L: Into<VersionedLocation> + Clone, T: Config> ContainsPair<L, L> for Autho
fn contains(origin: &L, target: &L) -> bool {
let origin: VersionedLocation = origin.clone().into();
let target: VersionedLocation = target.clone().into();
AuthorizedAliasesMap::<T>::get(&origin).contains(&target)
tracing::trace!(target: "xcm::pallet_xcm::AuthorizedAliases::contains", ?origin, ?target);
AuthorizedAliasesMap::<T>::get(&target).contains(&origin)
}
}
// pub struct AuthorizedAliases<T>(PhantomData<T>);
// impl<T: Config> ContainsPair<Location, Location> for AuthorizedAliases<T> {
// fn contains(origin: &Location, target: &Location) -> bool {
// let target = VersionedLocation::from(target.clone());
// AuthorizedAliasesMap::<T>::get(&origin).contains(&target)
// }
// }

/// Filter for `Location` to find those which represent a strict majority approval of an
/// identified plurality.
Expand Down

0 comments on commit e84293f

Please sign in to comment.