Skip to content

Commit

Permalink
feat(people-westend-runtime): add aliasers
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoaguirre committed Dec 9, 2024
1 parent 83abd9d commit 86737f9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 3 additions & 1 deletion cumulus/parachains/runtimes/people/people-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,9 @@ impl_runtime_apis! {
}

fn alias_origin() -> Result<(Location, Location), BenchmarkError> {
Err(BenchmarkError::Skip)
let origin = Location::new(1, [Parachain(1000)]);
let target = Location::new(1, [Parachain(1000), AccountId32 { id: [128u8; 32], network: None }]);
Ok((origin, target))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ impl<Call> XcmWeightInfo<Call> for PeopleWestendXcmWeight<Call> {
XcmGeneric::<Runtime>::clear_topic()
}
fn alias_origin(_: &Location) -> Weight {
// XCM Executor does not currently support alias origin operations
Weight::MAX
XcmGeneric::<Runtime>::alias_origin()
}
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
XcmGeneric::<Runtime>::unpaid_execution()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,13 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 603_000 picoseconds.
Weight::from_parts(634_000, 0)
}
pub fn alias_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(2_000_000, 0)
}
pub fn set_fees_mode() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ use xcm_builder::{
SendXcmFeeToAccount, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents,
XcmFeeManagerFromComponents, AliasChildLocation, AliasOriginRootUsingFilter,
};
use xcm_executor::XcmExecutor;

parameter_types! {
pub const RootLocation: Location = Location::here();
pub const RelayLocation: Location = Location::parent();
pub AssetHubLocation: Location = Location::new(1, [Parachain(1000)]);
pub const RelayNetwork: Option<NetworkId> = Some(NetworkId::ByGenesis(WESTEND_GENESIS_HASH));
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub UniversalLocation: InteriorLocation =
Expand Down Expand Up @@ -195,6 +196,13 @@ pub type WaivedLocations = (
LocalPlurality,
);

/// We allow locations to alias into their own child locations, as well as
/// AssetHub to alias into anything.
pub type Aliasers = (
AliasChildLocation,
AliasOriginRootUsingFilter<AssetHubLocation, Everything>,
);

pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
type RuntimeCall = RuntimeCall;
Expand Down Expand Up @@ -236,7 +244,7 @@ impl xcm_executor::Config for XcmConfig {
type UniversalAliases = Nothing;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
type Aliasers = Aliasers;
type TransactionalProcessor = FrameTransactionalProcessor;
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
Expand Down

0 comments on commit 86737f9

Please sign in to comment.