mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Rename Origin (#6020)
* Rename Origin
* fmt
* fixes
* more fixes
* fix
* more fixing
* small fixes
* last touches
* update lockfile for {"substrate"}
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -54,7 +54,7 @@ impl frame_system::Config for Test {
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
|
||||
@@ -60,7 +60,7 @@ impl frame_system::Config for Test {
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
@@ -103,7 +103,7 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type XcmSender = DevNull;
|
||||
type AssetTransactor = NoAssetTransactor;
|
||||
type OriginConverter = AlwaysSignedByDefault<Origin>;
|
||||
type OriginConverter = AlwaysSignedByDefault<RuntimeOrigin>;
|
||||
type IsReserve = AllAssetLocationsPass;
|
||||
type IsTeleporter = ();
|
||||
type LocationInverter = xcm_builder::LocationInverter<Ancestry>;
|
||||
@@ -159,18 +159,18 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
t.into()
|
||||
}
|
||||
|
||||
pub struct AlwaysSignedByDefault<Origin>(core::marker::PhantomData<Origin>);
|
||||
impl<Origin> ConvertOrigin<Origin> for AlwaysSignedByDefault<Origin>
|
||||
pub struct AlwaysSignedByDefault<RuntimeOrigin>(core::marker::PhantomData<RuntimeOrigin>);
|
||||
impl<RuntimeOrigin> ConvertOrigin<RuntimeOrigin> for AlwaysSignedByDefault<RuntimeOrigin>
|
||||
where
|
||||
Origin: OriginTrait,
|
||||
<Origin as OriginTrait>::AccountId: Decode,
|
||||
RuntimeOrigin: OriginTrait,
|
||||
<RuntimeOrigin as OriginTrait>::AccountId: Decode,
|
||||
{
|
||||
fn convert_origin(
|
||||
_origin: impl Into<MultiLocation>,
|
||||
_kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
Ok(Origin::signed(
|
||||
<Origin as OriginTrait>::AccountId::decode(&mut TrailingZeroInput::zeroes())
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
Ok(RuntimeOrigin::signed(
|
||||
<RuntimeOrigin as OriginTrait>::AccountId::decode(&mut TrailingZeroInput::zeroes())
|
||||
.expect("infinite length input; no invalid inputs for type; qed"),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ pub mod pallet {
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config<I: 'static = ()>: frame_system::Config + crate::Config {
|
||||
type RuntimeCall: Dispatchable<Origin = Self::Origin>
|
||||
type RuntimeCall: Dispatchable<RuntimeOrigin = Self::RuntimeOrigin>
|
||||
+ GetDispatchInfo
|
||||
+ From<frame_system::Call<Self>>
|
||||
+ Encode;
|
||||
|
||||
@@ -75,7 +75,10 @@ pub mod pallet {
|
||||
|
||||
/// Required origin for sending XCM messages. If successful, it resolves to `MultiLocation`
|
||||
/// which exists as an interior location within this chain's XCM context.
|
||||
type SendXcmOrigin: EnsureOrigin<<Self as SysConfig>::Origin, Success = MultiLocation>;
|
||||
type SendXcmOrigin: EnsureOrigin<
|
||||
<Self as SysConfig>::RuntimeOrigin,
|
||||
Success = MultiLocation,
|
||||
>;
|
||||
|
||||
/// The type used to actually dispatch an XCM to its destination.
|
||||
type XcmRouter: SendXcm;
|
||||
@@ -83,7 +86,10 @@ pub mod pallet {
|
||||
/// Required origin for executing XCM messages, including the teleport functionality. If successful,
|
||||
/// then it resolves to `MultiLocation` which exists as an interior location within this chain's XCM
|
||||
/// context.
|
||||
type ExecuteXcmOrigin: EnsureOrigin<<Self as SysConfig>::Origin, Success = MultiLocation>;
|
||||
type ExecuteXcmOrigin: EnsureOrigin<
|
||||
<Self as SysConfig>::RuntimeOrigin,
|
||||
Success = MultiLocation,
|
||||
>;
|
||||
|
||||
/// Our XCM filter which messages to be executed using `XcmExecutor` must pass.
|
||||
type XcmExecuteFilter: Contains<(MultiLocation, Xcm<<Self as SysConfig>::RuntimeCall>)>;
|
||||
@@ -104,13 +110,16 @@ pub mod pallet {
|
||||
type LocationInverter: InvertLocation;
|
||||
|
||||
/// The outer `Origin` type.
|
||||
type Origin: From<Origin> + From<<Self as SysConfig>::Origin>;
|
||||
type RuntimeOrigin: From<Origin> + From<<Self as SysConfig>::RuntimeOrigin>;
|
||||
|
||||
/// The outer `Call` type.
|
||||
type RuntimeCall: Parameter
|
||||
+ GetDispatchInfo
|
||||
+ IsType<<Self as frame_system::Config>::RuntimeCall>
|
||||
+ Dispatchable<Origin = <Self as Config>::Origin, PostInfo = PostDispatchInfo>;
|
||||
+ Dispatchable<
|
||||
RuntimeOrigin = <Self as Config>::RuntimeOrigin,
|
||||
PostInfo = PostDispatchInfo,
|
||||
>;
|
||||
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32;
|
||||
|
||||
@@ -1555,12 +1564,14 @@ where
|
||||
|
||||
/// A simple passthrough where we reuse the `MultiLocation`-typed XCM origin as the inner value of
|
||||
/// this crate's `Origin::Xcm` value.
|
||||
pub struct XcmPassthrough<Origin>(PhantomData<Origin>);
|
||||
impl<Origin: From<crate::Origin>> ConvertOrigin<Origin> for XcmPassthrough<Origin> {
|
||||
pub struct XcmPassthrough<RuntimeOrigin>(PhantomData<RuntimeOrigin>);
|
||||
impl<RuntimeOrigin: From<crate::Origin>> ConvertOrigin<RuntimeOrigin>
|
||||
for XcmPassthrough<RuntimeOrigin>
|
||||
{
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
match kind {
|
||||
OriginKind::Xcm => Ok(crate::Origin::Xcm(origin).into()),
|
||||
|
||||
@@ -52,8 +52,8 @@ pub mod pallet_test_notifier {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config + crate::Config {
|
||||
type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;
|
||||
type Origin: IsType<<Self as frame_system::Config>::Origin>
|
||||
+ Into<Result<crate::Origin, <Self as Config>::Origin>>;
|
||||
type RuntimeOrigin: IsType<<Self as frame_system::Config>::RuntimeOrigin>
|
||||
+ Into<Result<crate::Origin, <Self as Config>::RuntimeOrigin>>;
|
||||
type RuntimeCall: IsType<<Self as crate::Config>::RuntimeCall> + From<Call<Self>>;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ pub mod pallet_test_notifier {
|
||||
query_id: QueryId,
|
||||
response: Response,
|
||||
) -> DispatchResult {
|
||||
let responder = ensure_response(<T as Config>::Origin::from(origin))?;
|
||||
let responder = ensure_response(<T as Config>::RuntimeOrigin::from(origin))?;
|
||||
Self::deposit_event(Event::<T>::ResponseReceived(responder, query_id, response));
|
||||
Ok(())
|
||||
}
|
||||
@@ -171,7 +171,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl frame_system::Config for Test {
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -229,10 +229,10 @@ pub type LocalAssetTransactor =
|
||||
XcmCurrencyAdapter<Balances, IsConcrete<RelayLocation>, SovereignAccountOf, AccountId, ()>;
|
||||
|
||||
type LocalOriginConverter = (
|
||||
SovereignSignedViaLocation<SovereignAccountOf, Origin>,
|
||||
ChildParachainAsNative<origin::Origin, Origin>,
|
||||
SignedAccountId32AsNative<AnyNetwork, Origin>,
|
||||
ChildSystemParachainAsSuperuser<ParaId, Origin>,
|
||||
SovereignSignedViaLocation<SovereignAccountOf, RuntimeOrigin>,
|
||||
ChildParachainAsNative<origin::Origin, RuntimeOrigin>,
|
||||
SignedAccountId32AsNative<AnyNetwork, RuntimeOrigin>,
|
||||
ChildSystemParachainAsSuperuser<ParaId, RuntimeOrigin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
@@ -267,7 +267,7 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type SubscriptionService = XcmPallet;
|
||||
}
|
||||
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, AnyNetwork>;
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, AnyNetwork>;
|
||||
|
||||
parameter_types! {
|
||||
pub static AdvertisedXcmVersion: pallet_xcm::XcmVersion = 2;
|
||||
@@ -275,16 +275,16 @@ parameter_types! {
|
||||
|
||||
impl pallet_xcm::Config for Test {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmRouter = (TestSendXcmErrX8, TestSendXcm);
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = Everything;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
type AdvertisedXcmVersion = AdvertisedXcmVersion;
|
||||
@@ -294,7 +294,7 @@ impl origin::Config for Test {}
|
||||
|
||||
impl pallet_test_notifier::Config for Test {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,11 @@ fn send_works() {
|
||||
]);
|
||||
let versioned_dest = Box::new(RelayLocation::get().into());
|
||||
let versioned_message = Box::new(VersionedXcm::from(message.clone()));
|
||||
assert_ok!(XcmPallet::send(Origin::signed(ALICE), versioned_dest, versioned_message));
|
||||
assert_ok!(XcmPallet::send(
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
versioned_dest,
|
||||
versioned_message
|
||||
));
|
||||
assert_eq!(
|
||||
sent_xcm(),
|
||||
vec![(
|
||||
@@ -209,7 +213,7 @@ fn send_fails_when_xcm_router_blocks() {
|
||||
]);
|
||||
assert_noop!(
|
||||
XcmPallet::send(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(MultiLocation::ancestor(8).into()),
|
||||
Box::new(VersionedXcm::from(message.clone())),
|
||||
),
|
||||
@@ -233,7 +237,7 @@ fn teleport_assets_works() {
|
||||
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
|
||||
let dest: MultiLocation = AccountId32 { network: Any, id: BOB.into() }.into();
|
||||
assert_ok!(XcmPallet::teleport_assets(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(RelayLocation::get().into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
@@ -276,7 +280,7 @@ fn limmited_teleport_assets_works() {
|
||||
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
|
||||
let dest: MultiLocation = AccountId32 { network: Any, id: BOB.into() }.into();
|
||||
assert_ok!(XcmPallet::limited_teleport_assets(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(RelayLocation::get().into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
@@ -320,7 +324,7 @@ fn unlimmited_teleport_assets_works() {
|
||||
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
|
||||
let dest: MultiLocation = AccountId32 { network: Any, id: BOB.into() }.into();
|
||||
assert_ok!(XcmPallet::limited_teleport_assets(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(RelayLocation::get().into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
@@ -363,7 +367,7 @@ fn reserve_transfer_assets_works() {
|
||||
Junction::AccountId32 { network: NetworkId::Any, id: ALICE.into() }.into();
|
||||
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
|
||||
assert_ok!(XcmPallet::reserve_transfer_assets(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(Parachain(PARA_ID).into().into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
@@ -411,7 +415,7 @@ fn limited_reserve_transfer_assets_works() {
|
||||
Junction::AccountId32 { network: NetworkId::Any, id: ALICE.into() }.into();
|
||||
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
|
||||
assert_ok!(XcmPallet::limited_reserve_transfer_assets(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(Parachain(PARA_ID).into().into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
@@ -460,7 +464,7 @@ fn unlimited_reserve_transfer_assets_works() {
|
||||
Junction::AccountId32 { network: NetworkId::Any, id: ALICE.into() }.into();
|
||||
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
|
||||
assert_ok!(XcmPallet::limited_reserve_transfer_assets(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(Parachain(PARA_ID).into().into()),
|
||||
Box::new(dest.clone().into()),
|
||||
Box::new((Here, SEND_AMOUNT).into()),
|
||||
@@ -507,7 +511,7 @@ fn execute_withdraw_to_deposit_works() {
|
||||
Junction::AccountId32 { network: NetworkId::Any, id: BOB.into() }.into();
|
||||
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
|
||||
assert_ok!(XcmPallet::execute(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(VersionedXcm::from(Xcm(vec![
|
||||
WithdrawAsset((Here, SEND_AMOUNT).into()),
|
||||
buy_execution((Here, SEND_AMOUNT)),
|
||||
@@ -534,7 +538,7 @@ fn trapped_assets_can_be_claimed() {
|
||||
Junction::AccountId32 { network: NetworkId::Any, id: BOB.into() }.into();
|
||||
|
||||
assert_ok!(XcmPallet::execute(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(VersionedXcm::from(Xcm(vec![
|
||||
WithdrawAsset((Here, SEND_AMOUNT).into()),
|
||||
buy_execution((Here, SEND_AMOUNT)),
|
||||
@@ -569,7 +573,7 @@ fn trapped_assets_can_be_claimed() {
|
||||
|
||||
let weight = 3 * BaseXcmWeight::get();
|
||||
assert_ok!(XcmPallet::execute(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(VersionedXcm::from(Xcm(vec![
|
||||
ClaimAsset { assets: (Here, SEND_AMOUNT).into(), ticket: Here.into() },
|
||||
buy_execution((Here, SEND_AMOUNT)),
|
||||
@@ -584,7 +588,7 @@ fn trapped_assets_can_be_claimed() {
|
||||
|
||||
let weight = 3 * BaseXcmWeight::get();
|
||||
assert_ok!(XcmPallet::execute(
|
||||
Origin::signed(ALICE),
|
||||
RuntimeOrigin::signed(ALICE),
|
||||
Box::new(VersionedXcm::from(Xcm(vec![
|
||||
ClaimAsset { assets: (Here, SEND_AMOUNT).into(), ticket: Here.into() },
|
||||
buy_execution((Here, SEND_AMOUNT)),
|
||||
@@ -615,7 +619,7 @@ fn basic_subscription_works() {
|
||||
new_test_ext_with_balances(vec![]).execute_with(|| {
|
||||
let remote = Parachain(1000).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into()),
|
||||
));
|
||||
|
||||
@@ -658,13 +662,13 @@ fn subscriptions_increment_id() {
|
||||
new_test_ext_with_balances(vec![]).execute_with(|| {
|
||||
let remote = Parachain(1000).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into()),
|
||||
));
|
||||
|
||||
let remote2 = Parachain(1001).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote2.clone().into()),
|
||||
));
|
||||
|
||||
@@ -689,12 +693,12 @@ fn double_subscription_fails() {
|
||||
new_test_ext_with_balances(vec![]).execute_with(|| {
|
||||
let remote = Parachain(1000).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into()),
|
||||
));
|
||||
assert_noop!(
|
||||
XcmPallet::force_subscribe_version_notify(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into())
|
||||
),
|
||||
Error::<Test>::AlreadySubscribed,
|
||||
@@ -707,16 +711,16 @@ fn unsubscribe_works() {
|
||||
new_test_ext_with_balances(vec![]).execute_with(|| {
|
||||
let remote = Parachain(1000).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into()),
|
||||
));
|
||||
assert_ok!(XcmPallet::force_unsubscribe_version_notify(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into())
|
||||
));
|
||||
assert_noop!(
|
||||
XcmPallet::force_unsubscribe_version_notify(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into())
|
||||
),
|
||||
Error::<Test>::NoSubscription,
|
||||
@@ -851,7 +855,7 @@ fn subscriber_side_subscription_works() {
|
||||
new_test_ext_with_balances(vec![]).execute_with(|| {
|
||||
let remote = Parachain(1000).into();
|
||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Box::new(remote.clone().into()),
|
||||
));
|
||||
take_sent_xcm();
|
||||
@@ -893,7 +897,7 @@ fn auto_subscription_works() {
|
||||
let remote0 = Parachain(1000).into();
|
||||
let remote1 = Parachain(1001).into();
|
||||
|
||||
assert_ok!(XcmPallet::force_default_xcm_version(Origin::root(), Some(1)));
|
||||
assert_ok!(XcmPallet::force_default_xcm_version(RuntimeOrigin::root(), Some(1)));
|
||||
|
||||
// Wrapping a version for a destination we don't know elicits a subscription.
|
||||
let v1_msg = xcm::v1::Xcm::<()>::QueryResponse {
|
||||
|
||||
@@ -60,11 +60,11 @@ pub enum TestCall {
|
||||
Any(Weight, Option<Weight>),
|
||||
}
|
||||
impl Dispatchable for TestCall {
|
||||
type Origin = TestOrigin;
|
||||
type RuntimeOrigin = TestOrigin;
|
||||
type Config = ();
|
||||
type Info = ();
|
||||
type PostInfo = PostDispatchInfo;
|
||||
fn dispatch(self, origin: Self::Origin) -> DispatchResultWithPostInfo {
|
||||
fn dispatch(self, origin: Self::RuntimeOrigin) -> DispatchResultWithPostInfo {
|
||||
let mut post_info = PostDispatchInfo::default();
|
||||
let maybe_actual = match self {
|
||||
TestCall::OnlyRoot(_, maybe_actual) |
|
||||
|
||||
@@ -24,18 +24,20 @@ use xcm::latest::{BodyId, BodyPart, Junction, Junctions::*, MultiLocation, Netwo
|
||||
use xcm_executor::traits::{Convert, ConvertOrigin};
|
||||
|
||||
/// Sovereign accounts use the system's `Signed` origin with an account ID derived from the `LocationConverter`.
|
||||
pub struct SovereignSignedViaLocation<LocationConverter, Origin>(
|
||||
PhantomData<(LocationConverter, Origin)>,
|
||||
pub struct SovereignSignedViaLocation<LocationConverter, RuntimeOrigin>(
|
||||
PhantomData<(LocationConverter, RuntimeOrigin)>,
|
||||
);
|
||||
impl<LocationConverter: Convert<MultiLocation, Origin::AccountId>, Origin: OriginTrait>
|
||||
ConvertOrigin<Origin> for SovereignSignedViaLocation<LocationConverter, Origin>
|
||||
impl<
|
||||
LocationConverter: Convert<MultiLocation, RuntimeOrigin::AccountId>,
|
||||
RuntimeOrigin: OriginTrait,
|
||||
> ConvertOrigin<RuntimeOrigin> for SovereignSignedViaLocation<LocationConverter, RuntimeOrigin>
|
||||
where
|
||||
Origin::AccountId: Clone,
|
||||
RuntimeOrigin::AccountId: Clone,
|
||||
{
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
log::trace!(
|
||||
target: "xcm::origin_conversion",
|
||||
@@ -44,57 +46,61 @@ where
|
||||
);
|
||||
if let OriginKind::SovereignAccount = kind {
|
||||
let location = LocationConverter::convert(origin)?;
|
||||
Ok(Origin::signed(location).into())
|
||||
Ok(RuntimeOrigin::signed(location).into())
|
||||
} else {
|
||||
Err(origin)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ParentAsSuperuser<Origin>(PhantomData<Origin>);
|
||||
impl<Origin: OriginTrait> ConvertOrigin<Origin> for ParentAsSuperuser<Origin> {
|
||||
pub struct ParentAsSuperuser<RuntimeOrigin>(PhantomData<RuntimeOrigin>);
|
||||
impl<RuntimeOrigin: OriginTrait> ConvertOrigin<RuntimeOrigin> for ParentAsSuperuser<RuntimeOrigin> {
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
log::trace!(target: "xcm::origin_conversion", "ParentAsSuperuser origin: {:?}, kind: {:?}", origin, kind);
|
||||
if kind == OriginKind::Superuser && origin.contains_parents_only(1) {
|
||||
Ok(Origin::root())
|
||||
Ok(RuntimeOrigin::root())
|
||||
} else {
|
||||
Err(origin)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ChildSystemParachainAsSuperuser<ParaId, Origin>(PhantomData<(ParaId, Origin)>);
|
||||
impl<ParaId: IsSystem + From<u32>, Origin: OriginTrait> ConvertOrigin<Origin>
|
||||
for ChildSystemParachainAsSuperuser<ParaId, Origin>
|
||||
pub struct ChildSystemParachainAsSuperuser<ParaId, RuntimeOrigin>(
|
||||
PhantomData<(ParaId, RuntimeOrigin)>,
|
||||
);
|
||||
impl<ParaId: IsSystem + From<u32>, RuntimeOrigin: OriginTrait> ConvertOrigin<RuntimeOrigin>
|
||||
for ChildSystemParachainAsSuperuser<ParaId, RuntimeOrigin>
|
||||
{
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
log::trace!(target: "xcm::origin_conversion", "ChildSystemParachainAsSuperuser origin: {:?}, kind: {:?}", origin, kind);
|
||||
match (kind, origin) {
|
||||
(
|
||||
OriginKind::Superuser,
|
||||
MultiLocation { parents: 0, interior: X1(Junction::Parachain(id)) },
|
||||
) if ParaId::from(id).is_system() => Ok(Origin::root()),
|
||||
) if ParaId::from(id).is_system() => Ok(RuntimeOrigin::root()),
|
||||
(_, origin) => Err(origin),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SiblingSystemParachainAsSuperuser<ParaId, Origin>(PhantomData<(ParaId, Origin)>);
|
||||
impl<ParaId: IsSystem + From<u32>, Origin: OriginTrait> ConvertOrigin<Origin>
|
||||
for SiblingSystemParachainAsSuperuser<ParaId, Origin>
|
||||
pub struct SiblingSystemParachainAsSuperuser<ParaId, RuntimeOrigin>(
|
||||
PhantomData<(ParaId, RuntimeOrigin)>,
|
||||
);
|
||||
impl<ParaId: IsSystem + From<u32>, RuntimeOrigin: OriginTrait> ConvertOrigin<RuntimeOrigin>
|
||||
for SiblingSystemParachainAsSuperuser<ParaId, RuntimeOrigin>
|
||||
{
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
log::trace!(
|
||||
target: "xcm::origin_conversion",
|
||||
@@ -105,42 +111,44 @@ impl<ParaId: IsSystem + From<u32>, Origin: OriginTrait> ConvertOrigin<Origin>
|
||||
(
|
||||
OriginKind::Superuser,
|
||||
MultiLocation { parents: 1, interior: X1(Junction::Parachain(id)) },
|
||||
) if ParaId::from(id).is_system() => Ok(Origin::root()),
|
||||
) if ParaId::from(id).is_system() => Ok(RuntimeOrigin::root()),
|
||||
(_, origin) => Err(origin),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ChildParachainAsNative<ParachainOrigin, Origin>(PhantomData<(ParachainOrigin, Origin)>);
|
||||
impl<ParachainOrigin: From<u32>, Origin: From<ParachainOrigin>> ConvertOrigin<Origin>
|
||||
for ChildParachainAsNative<ParachainOrigin, Origin>
|
||||
pub struct ChildParachainAsNative<ParachainOrigin, RuntimeOrigin>(
|
||||
PhantomData<(ParachainOrigin, RuntimeOrigin)>,
|
||||
);
|
||||
impl<ParachainOrigin: From<u32>, RuntimeOrigin: From<ParachainOrigin>> ConvertOrigin<RuntimeOrigin>
|
||||
for ChildParachainAsNative<ParachainOrigin, RuntimeOrigin>
|
||||
{
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
log::trace!(target: "xcm::origin_conversion", "ChildParachainAsNative origin: {:?}, kind: {:?}", origin, kind);
|
||||
match (kind, origin) {
|
||||
(
|
||||
OriginKind::Native,
|
||||
MultiLocation { parents: 0, interior: X1(Junction::Parachain(id)) },
|
||||
) => Ok(Origin::from(ParachainOrigin::from(id))),
|
||||
) => Ok(RuntimeOrigin::from(ParachainOrigin::from(id))),
|
||||
(_, origin) => Err(origin),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SiblingParachainAsNative<ParachainOrigin, Origin>(
|
||||
PhantomData<(ParachainOrigin, Origin)>,
|
||||
pub struct SiblingParachainAsNative<ParachainOrigin, RuntimeOrigin>(
|
||||
PhantomData<(ParachainOrigin, RuntimeOrigin)>,
|
||||
);
|
||||
impl<ParachainOrigin: From<u32>, Origin: From<ParachainOrigin>> ConvertOrigin<Origin>
|
||||
for SiblingParachainAsNative<ParachainOrigin, Origin>
|
||||
impl<ParachainOrigin: From<u32>, RuntimeOrigin: From<ParachainOrigin>> ConvertOrigin<RuntimeOrigin>
|
||||
for SiblingParachainAsNative<ParachainOrigin, RuntimeOrigin>
|
||||
{
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
log::trace!(
|
||||
target: "xcm::origin_conversion",
|
||||
@@ -151,21 +159,23 @@ impl<ParachainOrigin: From<u32>, Origin: From<ParachainOrigin>> ConvertOrigin<Or
|
||||
(
|
||||
OriginKind::Native,
|
||||
MultiLocation { parents: 1, interior: X1(Junction::Parachain(id)) },
|
||||
) => Ok(Origin::from(ParachainOrigin::from(id))),
|
||||
) => Ok(RuntimeOrigin::from(ParachainOrigin::from(id))),
|
||||
(_, origin) => Err(origin),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Our Relay-chain has a native origin given by the `Get`ter.
|
||||
pub struct RelayChainAsNative<RelayOrigin, Origin>(PhantomData<(RelayOrigin, Origin)>);
|
||||
impl<RelayOrigin: Get<Origin>, Origin> ConvertOrigin<Origin>
|
||||
for RelayChainAsNative<RelayOrigin, Origin>
|
||||
pub struct RelayChainAsNative<RelayOrigin, RuntimeOrigin>(
|
||||
PhantomData<(RelayOrigin, RuntimeOrigin)>,
|
||||
);
|
||||
impl<RelayOrigin: Get<RuntimeOrigin>, RuntimeOrigin> ConvertOrigin<RuntimeOrigin>
|
||||
for RelayChainAsNative<RelayOrigin, RuntimeOrigin>
|
||||
{
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
log::trace!(target: "xcm::origin_conversion", "RelayChainAsNative origin: {:?}, kind: {:?}", origin, kind);
|
||||
if kind == OriginKind::Native && origin.contains_parents_only(1) {
|
||||
@@ -176,16 +186,16 @@ impl<RelayOrigin: Get<Origin>, Origin> ConvertOrigin<Origin>
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SignedAccountId32AsNative<Network, Origin>(PhantomData<(Network, Origin)>);
|
||||
impl<Network: Get<NetworkId>, Origin: OriginTrait> ConvertOrigin<Origin>
|
||||
for SignedAccountId32AsNative<Network, Origin>
|
||||
pub struct SignedAccountId32AsNative<Network, RuntimeOrigin>(PhantomData<(Network, RuntimeOrigin)>);
|
||||
impl<Network: Get<NetworkId>, RuntimeOrigin: OriginTrait> ConvertOrigin<RuntimeOrigin>
|
||||
for SignedAccountId32AsNative<Network, RuntimeOrigin>
|
||||
where
|
||||
Origin::AccountId: From<[u8; 32]>,
|
||||
RuntimeOrigin::AccountId: From<[u8; 32]>,
|
||||
{
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
log::trace!(
|
||||
target: "xcm::origin_conversion",
|
||||
@@ -197,22 +207,24 @@ where
|
||||
OriginKind::Native,
|
||||
MultiLocation { parents: 0, interior: X1(Junction::AccountId32 { id, network }) },
|
||||
) if matches!(network, NetworkId::Any) || network == Network::get() =>
|
||||
Ok(Origin::signed(id.into())),
|
||||
Ok(RuntimeOrigin::signed(id.into())),
|
||||
(_, origin) => Err(origin),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SignedAccountKey20AsNative<Network, Origin>(PhantomData<(Network, Origin)>);
|
||||
impl<Network: Get<NetworkId>, Origin: OriginTrait> ConvertOrigin<Origin>
|
||||
for SignedAccountKey20AsNative<Network, Origin>
|
||||
pub struct SignedAccountKey20AsNative<Network, RuntimeOrigin>(
|
||||
PhantomData<(Network, RuntimeOrigin)>,
|
||||
);
|
||||
impl<Network: Get<NetworkId>, RuntimeOrigin: OriginTrait> ConvertOrigin<RuntimeOrigin>
|
||||
for SignedAccountKey20AsNative<Network, RuntimeOrigin>
|
||||
where
|
||||
Origin::AccountId: From<[u8; 20]>,
|
||||
RuntimeOrigin::AccountId: From<[u8; 20]>,
|
||||
{
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
log::trace!(
|
||||
target: "xcm::origin_conversion",
|
||||
@@ -224,28 +236,28 @@ where
|
||||
OriginKind::Native,
|
||||
MultiLocation { parents: 0, interior: X1(Junction::AccountKey20 { key, network }) },
|
||||
) if (matches!(network, NetworkId::Any) || network == Network::get()) =>
|
||||
Ok(Origin::signed(key.into())),
|
||||
Ok(RuntimeOrigin::signed(key.into())),
|
||||
(_, origin) => Err(origin),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `EnsureOrigin` barrier to convert from dispatch origin to XCM origin, if one exists.
|
||||
pub struct EnsureXcmOrigin<Origin, Conversion>(PhantomData<(Origin, Conversion)>);
|
||||
impl<Origin: OriginTrait + Clone, Conversion: Convert<Origin, MultiLocation>> EnsureOrigin<Origin>
|
||||
for EnsureXcmOrigin<Origin, Conversion>
|
||||
pub struct EnsureXcmOrigin<RuntimeOrigin, Conversion>(PhantomData<(RuntimeOrigin, Conversion)>);
|
||||
impl<RuntimeOrigin: OriginTrait + Clone, Conversion: Convert<RuntimeOrigin, MultiLocation>>
|
||||
EnsureOrigin<RuntimeOrigin> for EnsureXcmOrigin<RuntimeOrigin, Conversion>
|
||||
where
|
||||
Origin::PalletsOrigin: PartialEq,
|
||||
RuntimeOrigin::PalletsOrigin: PartialEq,
|
||||
{
|
||||
type Success = MultiLocation;
|
||||
fn try_origin(o: Origin) -> Result<Self::Success, Origin> {
|
||||
fn try_origin(o: RuntimeOrigin) -> Result<Self::Success, RuntimeOrigin> {
|
||||
let o = match Conversion::convert(o) {
|
||||
Ok(location) => return Ok(location),
|
||||
Err(o) => o,
|
||||
};
|
||||
// We institute a root fallback so root can always represent the context. This
|
||||
// guarantees that `successful_origin` will work.
|
||||
if o.caller() == Origin::root().caller() {
|
||||
if o.caller() == RuntimeOrigin::root().caller() {
|
||||
Ok(Here.into())
|
||||
} else {
|
||||
Err(o)
|
||||
@@ -253,8 +265,8 @@ where
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn try_successful_origin() -> Result<Origin, ()> {
|
||||
Ok(Origin::root())
|
||||
fn try_successful_origin() -> Result<RuntimeOrigin, ()> {
|
||||
Ok(RuntimeOrigin::root())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,16 +274,16 @@ where
|
||||
///
|
||||
/// Typically used when configuring `pallet-xcm` for allowing normal accounts to dispatch an XCM from an `AccountId32`
|
||||
/// origin.
|
||||
pub struct SignedToAccountId32<Origin, AccountId, Network>(
|
||||
PhantomData<(Origin, AccountId, Network)>,
|
||||
pub struct SignedToAccountId32<RuntimeOrigin, AccountId, Network>(
|
||||
PhantomData<(RuntimeOrigin, AccountId, Network)>,
|
||||
);
|
||||
impl<Origin: OriginTrait + Clone, AccountId: Into<[u8; 32]>, Network: Get<NetworkId>>
|
||||
Convert<Origin, MultiLocation> for SignedToAccountId32<Origin, AccountId, Network>
|
||||
impl<RuntimeOrigin: OriginTrait + Clone, AccountId: Into<[u8; 32]>, Network: Get<NetworkId>>
|
||||
Convert<RuntimeOrigin, MultiLocation> for SignedToAccountId32<RuntimeOrigin, AccountId, Network>
|
||||
where
|
||||
Origin::PalletsOrigin: From<SystemRawOrigin<AccountId>>
|
||||
+ TryInto<SystemRawOrigin<AccountId>, Error = Origin::PalletsOrigin>,
|
||||
RuntimeOrigin::PalletsOrigin: From<SystemRawOrigin<AccountId>>
|
||||
+ TryInto<SystemRawOrigin<AccountId>, Error = RuntimeOrigin::PalletsOrigin>,
|
||||
{
|
||||
fn convert(o: Origin) -> Result<MultiLocation, Origin> {
|
||||
fn convert(o: RuntimeOrigin) -> Result<MultiLocation, RuntimeOrigin> {
|
||||
o.try_with_caller(|caller| match caller.try_into() {
|
||||
Ok(SystemRawOrigin::Signed(who)) =>
|
||||
Ok(Junction::AccountId32 { network: Network::get(), id: who.into() }.into()),
|
||||
@@ -286,13 +298,16 @@ where
|
||||
///
|
||||
/// Typically used when configuring `pallet-xcm` for allowing a collective's Origin to dispatch an XCM from a
|
||||
/// `Plurality` origin.
|
||||
pub struct BackingToPlurality<Origin, COrigin, Body>(PhantomData<(Origin, COrigin, Body)>);
|
||||
impl<Origin: OriginTrait + Clone, COrigin: GetBacking, Body: Get<BodyId>>
|
||||
Convert<Origin, MultiLocation> for BackingToPlurality<Origin, COrigin, Body>
|
||||
pub struct BackingToPlurality<RuntimeOrigin, COrigin, Body>(
|
||||
PhantomData<(RuntimeOrigin, COrigin, Body)>,
|
||||
);
|
||||
impl<RuntimeOrigin: OriginTrait + Clone, COrigin: GetBacking, Body: Get<BodyId>>
|
||||
Convert<RuntimeOrigin, MultiLocation> for BackingToPlurality<RuntimeOrigin, COrigin, Body>
|
||||
where
|
||||
Origin::PalletsOrigin: From<COrigin> + TryInto<COrigin, Error = Origin::PalletsOrigin>,
|
||||
RuntimeOrigin::PalletsOrigin:
|
||||
From<COrigin> + TryInto<COrigin, Error = RuntimeOrigin::PalletsOrigin>,
|
||||
{
|
||||
fn convert(o: Origin) -> Result<MultiLocation, Origin> {
|
||||
fn convert(o: RuntimeOrigin) -> Result<MultiLocation, RuntimeOrigin> {
|
||||
o.try_with_caller(|caller| match caller.try_into() {
|
||||
Ok(co) => match co.get_backing() {
|
||||
Some(backing) => Ok(Junction::Plurality {
|
||||
|
||||
@@ -61,7 +61,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -133,10 +133,10 @@ pub type LocalCurrencyAdapter = XcmCurrencyAdapter<
|
||||
pub type LocalAssetTransactor = (LocalCurrencyAdapter,);
|
||||
|
||||
type LocalOriginConverter = (
|
||||
SovereignSignedViaLocation<SovereignAccountOf, Origin>,
|
||||
ChildParachainAsNative<origin::Origin, Origin>,
|
||||
SignedAccountId32AsNative<KusamaNetwork, Origin>,
|
||||
ChildSystemParachainAsSuperuser<ParaId, Origin>,
|
||||
SovereignSignedViaLocation<SovereignAccountOf, RuntimeOrigin>,
|
||||
ChildParachainAsNative<origin::Origin, RuntimeOrigin>,
|
||||
SignedAccountId32AsNative<KusamaNetwork, RuntimeOrigin>,
|
||||
ChildSystemParachainAsSuperuser<ParaId, RuntimeOrigin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
@@ -176,22 +176,22 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type SubscriptionService = XcmPallet;
|
||||
}
|
||||
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>;
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, KusamaNetwork>;
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmRouter = TestSendXcm;
|
||||
// Anyone can execute XCM messages locally...
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = Nothing;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ pub trait Config {
|
||||
type AssetTransactor: TransactAsset;
|
||||
|
||||
/// How to get a call origin from a `OriginKind` value.
|
||||
type OriginConverter: ConvertOrigin<<Self::RuntimeCall as Dispatchable>::Origin>;
|
||||
type OriginConverter: ConvertOrigin<<Self::RuntimeCall as Dispatchable>::RuntimeOrigin>;
|
||||
|
||||
/// Combinations of (Location, Asset) pairs which we trust as reserves.
|
||||
type IsReserve: FilterAssetLocation;
|
||||
|
||||
@@ -206,7 +206,7 @@ mod tests {
|
||||
|
||||
Relay::execute_with(|| {
|
||||
assert_ok!(RelayChainPalletXcm::reserve_transfer_assets(
|
||||
relay_chain::Origin::signed(ALICE),
|
||||
relay_chain::RuntimeOrigin::signed(ALICE),
|
||||
Box::new(X1(Parachain(1)).into().into()),
|
||||
Box::new(X1(AccountId32 { network: Any, id: ALICE.into() }).into().into()),
|
||||
Box::new((Here, withdraw_amount).into()),
|
||||
|
||||
@@ -52,7 +52,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -114,9 +114,9 @@ pub type LocationToAccountId = (
|
||||
);
|
||||
|
||||
pub type XcmOriginToCallOrigin = (
|
||||
SovereignSignedViaLocation<LocationToAccountId, Origin>,
|
||||
SignedAccountId32AsNative<RelayNetwork, Origin>,
|
||||
XcmPassthrough<Origin>,
|
||||
SovereignSignedViaLocation<LocationToAccountId, RuntimeOrigin>,
|
||||
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
|
||||
XcmPassthrough<RuntimeOrigin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
@@ -298,20 +298,20 @@ impl mock_msg_queue::Config for Runtime {
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
}
|
||||
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmRouter = XcmRouter;
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = Everything;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Nothing;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
|
||||
|
||||
@@ -42,7 +42,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -107,10 +107,10 @@ pub type LocalAssetTransactor =
|
||||
XcmCurrencyAdapter<Balances, IsConcrete<KsmLocation>, SovereignAccountOf, AccountId, ()>;
|
||||
|
||||
type LocalOriginConverter = (
|
||||
SovereignSignedViaLocation<SovereignAccountOf, Origin>,
|
||||
ChildParachainAsNative<origin::Origin, Origin>,
|
||||
SignedAccountId32AsNative<KusamaNetwork, Origin>,
|
||||
ChildSystemParachainAsSuperuser<ParaId, Origin>,
|
||||
SovereignSignedViaLocation<SovereignAccountOf, RuntimeOrigin>,
|
||||
ChildParachainAsNative<origin::Origin, RuntimeOrigin>,
|
||||
SignedAccountId32AsNative<KusamaNetwork, RuntimeOrigin>,
|
||||
ChildSystemParachainAsSuperuser<ParaId, RuntimeOrigin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
@@ -140,21 +140,21 @@ impl Config for XcmConfig {
|
||||
type SubscriptionService = ();
|
||||
}
|
||||
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>;
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, KusamaNetwork>;
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmRouter = XcmRouter;
|
||||
// Anyone can execute XCM messages locally...
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = Nothing;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
|
||||
|
||||
@@ -52,7 +52,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -114,9 +114,9 @@ pub type LocationToAccountId = (
|
||||
);
|
||||
|
||||
pub type XcmOriginToCallOrigin = (
|
||||
SovereignSignedViaLocation<LocationToAccountId, Origin>,
|
||||
SignedAccountId32AsNative<RelayNetwork, Origin>,
|
||||
XcmPassthrough<Origin>,
|
||||
SovereignSignedViaLocation<LocationToAccountId, RuntimeOrigin>,
|
||||
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
|
||||
XcmPassthrough<RuntimeOrigin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
@@ -298,20 +298,20 @@ impl mock_msg_queue::Config for Runtime {
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
}
|
||||
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmRouter = XcmRouter;
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = Everything;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Nothing;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
|
||||
|
||||
@@ -42,7 +42,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -107,10 +107,10 @@ pub type LocalAssetTransactor =
|
||||
XcmCurrencyAdapter<Balances, IsConcrete<KsmLocation>, SovereignAccountOf, AccountId, ()>;
|
||||
|
||||
type LocalOriginConverter = (
|
||||
SovereignSignedViaLocation<SovereignAccountOf, Origin>,
|
||||
ChildParachainAsNative<origin::Origin, Origin>,
|
||||
SignedAccountId32AsNative<KusamaNetwork, Origin>,
|
||||
ChildSystemParachainAsSuperuser<ParaId, Origin>,
|
||||
SovereignSignedViaLocation<SovereignAccountOf, RuntimeOrigin>,
|
||||
ChildParachainAsNative<origin::Origin, RuntimeOrigin>,
|
||||
SignedAccountId32AsNative<KusamaNetwork, RuntimeOrigin>,
|
||||
ChildSystemParachainAsSuperuser<ParaId, RuntimeOrigin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
@@ -140,21 +140,21 @@ impl Config for XcmConfig {
|
||||
type SubscriptionService = ();
|
||||
}
|
||||
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>;
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, KusamaNetwork>;
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmRouter = XcmRouter;
|
||||
// Anyone can execute XCM messages locally...
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = Nothing;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
|
||||
|
||||
Reference in New Issue
Block a user