@@ -27,7 +27,7 @@ use crate::{
2727use codec:: { Decode , DecodeLimit , Encode } ;
2828use frame_support:: {
2929 ensure, parameter_types,
30- traits:: { Contains , Everything , Nothing , ProcessMessageError } ,
30+ traits:: { Contains , Equals , Everything , Nothing , ProcessMessageError } ,
3131 weights:: Weight ,
3232} ;
3333use pallet_xcm_bridge_hub:: XcmAsPlainPayload ;
@@ -36,10 +36,10 @@ use sp_io::hashing::blake2_256;
3636use xcm:: { latest:: prelude:: * , VersionedInteriorLocation , VersionedXcm , MAX_XCM_DECODE_DEPTH } ;
3737use xcm_builder:: {
3838 DispatchBlob , DispatchBlobError , FixedWeightBounds , FrameTransactionalProcessor , LocalExporter ,
39- TrailingSetTopicAsId , WithComputedOrigin ,
39+ LocationAsSuperuser , TrailingSetTopicAsId , WithComputedOrigin ,
4040} ;
4141use xcm_executor:: {
42- traits:: { ConvertOrigin , ShouldExecute , WeightTrader , WithOriginFilter } ,
42+ traits:: { ShouldExecute , WeightTrader , WithOriginFilter } ,
4343 AssetsInHolding , XcmExecutor ,
4444} ;
4545
@@ -78,30 +78,6 @@ impl Contains<(Location, Junction)> for UniversalAliases {
7878 }
7979}
8080
81- /// Kawabunga location converter to local root.
82- pub struct KawabungaParachainAsRoot ;
83-
84- impl ConvertOrigin < RuntimeOrigin > for KawabungaParachainAsRoot {
85- fn convert_origin (
86- origin : impl Into < Location > ,
87- kind : OriginKind ,
88- ) -> Result < RuntimeOrigin , Location > {
89- let origin = origin. into ( ) ;
90- log:: trace!(
91- target: "xcm::origin_conversion" ,
92- "KawabungaParachainAsRoot origin: {:?}, kind: {:?}" ,
93- origin, kind,
94- ) ;
95- match ( kind, origin. unpack ( ) ) {
96- (
97- OriginKind :: Superuser ,
98- ( 1 , [ GlobalConsensus ( bridged_network) , Parachain ( PEOPLE_POLKADOT_PARACHAIN_ID ) ] ) ,
99- ) if bridged_network == & BridgedNetwork :: get ( ) => Ok ( RuntimeOrigin :: root ( ) ) ,
100- _ => Err ( origin) ,
101- }
102- }
103- }
104-
10581/// Weight trader that does nothing.
10682pub struct NoopTrader ;
10783
@@ -150,14 +126,11 @@ impl<RuntimeCall: Decode, AllowedOrigin: Contains<Location>> ShouldExecute
150126 }
151127}
152128
153- /// The means that we convert an XCM origin `MultiLocation ` into the runtime's `Origin` type for
129+ /// The means that we convert an XCM origin `Location ` into the runtime's `Origin` type for
154130/// local dispatch. This is a conversion function from an `OriginKind` type along with the
155- /// `MultiLocation` value and returns an `Origin` value or an error.
156- type LocalOriginConverter = (
157- // Currently we only accept XCM messages from Kawabunga and the origin for such messages
158- // is local root.
159- KawabungaParachainAsRoot ,
160- ) ;
131+ /// `Location` value and returns an `Origin` value or an error.
132+ type XcmOriginToTransactDispatchOrigin =
133+ ( LocationAsSuperuser < Equals < PeoplePolkadotLocation > , RuntimeOrigin > , ) ;
161134
162135/// Only bridged destination is supported.
163136pub type XcmRouter = LocalExporter < ToBridgeHaulBlobExporter , UniversalLocation > ;
@@ -179,7 +152,7 @@ impl xcm_executor::Config for XcmConfig {
179152 type RuntimeCall = RuntimeCall ;
180153 type XcmSender = XcmRouter ;
181154 type AssetTransactor = ( ) ;
182- type OriginConverter = LocalOriginConverter ;
155+ type OriginConverter = XcmOriginToTransactDispatchOrigin ;
183156 type IsReserve = ( ) ;
184157 type IsTeleporter = ( ) ;
185158 type UniversalLocation = UniversalLocation ;
@@ -207,6 +180,7 @@ impl xcm_executor::Config for XcmConfig {
207180 type HrmpChannelAcceptedHandler = ( ) ;
208181 type HrmpChannelClosingHandler = ( ) ;
209182 type XcmRecorder = ( ) ;
183+ // TODO: add here some impl?
210184 type XcmEventEmitter = ( ) ;
211185}
212186
0 commit comments