Skip to content

Commit

Permalink
feat(coretime-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 86737f9 commit 767b39a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,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 @@ -261,8 +261,7 @@ impl<Call> XcmWeightInfo<Call> for CoretimeWestendXcmWeight<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: 572_000 picoseconds.
Weight::from_parts(631_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 @@ -47,13 +47,14 @@ use xcm_builder::{
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 TokenRelayLocation: 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 @@ -191,6 +192,13 @@ pub type WaivedLocations = (
Equals<RelayTreasuryLocation>,
);

/// 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 @@ -232,7 +240,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 767b39a

Please sign in to comment.