@@ -2,7 +2,6 @@ use super::{
2
2
AccountId , AllPalletsWithSystem , Balances , ParachainInfo , ParachainSystem , PolkadotXcm ,
3
3
Runtime , RuntimeCall , RuntimeEvent , RuntimeOrigin , WeightToFee , XcmpQueue ,
4
4
} ;
5
- use cumulus_primitives_core:: { IsSystem , ParaId } ;
6
5
use frame_support:: {
7
6
match_types, parameter_types,
8
7
traits:: { ConstU32 , ContainsPair , Everything , Nothing } ,
@@ -15,11 +14,11 @@ use polkadot_runtime_common::impls::ToAuthor;
15
14
use xcm:: latest:: prelude:: * ;
16
15
use xcm_builder:: {
17
16
AccountId32Aliases , AllowExplicitUnpaidExecutionFrom , AllowSubscriptionsFrom ,
18
- AllowTopLevelPaidExecutionFrom , CurrencyAdapter , DenyReserveTransferToRelayChain , DenyThenTry ,
19
- EnsureXcmOrigin , FixedWeightBounds , IsConcrete , ParentAsSuperuser , ParentIsPreset ,
20
- RelayChainAsNative , SiblingParachainAsNative , SiblingParachainConvertsVia ,
21
- SignedAccountId32AsNative , SignedToAccountId32 , SovereignSignedViaLocation , TakeWeightCredit ,
22
- TrailingSetTopicAsId , UsingComponents , WithComputedOrigin , WithUniqueTopic ,
17
+ AllowTopLevelPaidExecutionFrom , CurrencyAdapter , EnsureXcmOrigin , FixedWeightBounds ,
18
+ IsConcrete , ParentAsSuperuser , ParentIsPreset , RelayChainAsNative , SiblingParachainAsNative ,
19
+ SiblingParachainConvertsVia , SignedAccountId32AsNative , SignedToAccountId32 ,
20
+ SovereignSignedViaLocation , TakeWeightCredit , TrailingSetTopicAsId , UsingComponents ,
21
+ WithComputedOrigin , WithUniqueTopic ,
23
22
} ;
24
23
use xcm_executor:: XcmExecutor ;
25
24
@@ -105,25 +104,20 @@ match_types! {
105
104
} ;
106
105
}
107
106
108
- pub type Barrier = TrailingSetTopicAsId <
109
- DenyThenTry <
110
- DenyReserveTransferToRelayChain ,
107
+ pub type Barrier = TrailingSetTopicAsId < (
108
+ TakeWeightCredit ,
109
+ WithComputedOrigin <
111
110
(
112
- TakeWeightCredit ,
113
- WithComputedOrigin <
114
- (
115
- AllowTopLevelPaidExecutionFrom < Everything > ,
116
- // Parents or their pluralities (governnace) get free execution.
117
- AllowExplicitUnpaidExecutionFrom < ParentOrParentsExecutivePlurality > ,
118
- // Subscriptions for version tracking are OK.
119
- AllowSubscriptionsFrom < ParentOrSiblings > ,
120
- ) ,
121
- UniversalLocation ,
122
- ConstU32 < 8 > ,
123
- > ,
111
+ AllowTopLevelPaidExecutionFrom < Everything > ,
112
+ // Parents or their pluralities (governnace) get free execution.
113
+ AllowExplicitUnpaidExecutionFrom < ParentOrParentsExecutivePlurality > ,
114
+ // Subscriptions for version tracking are OK.
115
+ AllowSubscriptionsFrom < ParentOrSiblings > ,
124
116
) ,
117
+ UniversalLocation ,
118
+ ConstU32 < 8 > ,
125
119
> ,
126
- > ;
120
+ ) > ;
127
121
128
122
pub struct XcmConfig ;
129
123
impl xcm_executor:: Config for XcmConfig {
@@ -132,10 +126,10 @@ impl xcm_executor::Config for XcmConfig {
132
126
// How to withdraw and deposit an asset.
133
127
type AssetTransactor = CurrencyTransactor ;
134
128
type OriginConverter = XcmOriginToTransactDispatchOrigin ;
135
- // Sugondat does not recognize a reserve location for any asset. Users must teleport KSM
136
- // where allowed (e.g. with the Relay Chain).
137
- type IsReserve = ( ) ;
138
- type IsTeleporter = TrustedTeleporters ;
129
+ // Sugondat recognizes the relay chain as a reserve asset.
130
+ type IsReserve = TrustedReserve ;
131
+ // Sugondat is not formally part of the system and therefore should not be used for teleportation.
132
+ type IsTeleporter = ( ) ;
139
133
type UniversalLocation = UniversalLocation ;
140
134
type Barrier = Barrier ;
141
135
type Weigher = FixedWeightBounds < UnitWeightCost , RuntimeCall , MaxInstructions > ;
@@ -170,32 +164,29 @@ pub type XcmRouter = WithUniqueTopic<(
170
164
XcmpQueue ,
171
165
) > ;
172
166
173
- /// Accepts an asset if it is a concrete asset from the system (Relay Chain or system parachain) .
174
- pub struct KusamaAndSystemAsset ;
175
- impl ContainsPair < MultiAsset , MultiLocation > for KusamaAndSystemAsset {
167
+ /// Accepts an asset if it is a concrete asset from the system using the relay chain as a reserve .
168
+ pub struct ParentRelayChainAndAsset ;
169
+ impl ContainsPair < MultiAsset , MultiLocation > for ParentRelayChainAndAsset {
176
170
fn contains ( asset : & MultiAsset , origin : & MultiLocation ) -> bool {
177
- log:: trace!( target: "xcm::contains" , "KusamaAndSystemAsset asset: {:?}, origin: {:?}" , asset, origin) ;
171
+ log:: trace!( target: "xcm::contains" , "ParentRelayChain asset: {:?}, origin: {:?}" , asset, origin) ;
178
172
let is_system = match origin {
179
173
// The Relay Chain
180
174
MultiLocation {
181
175
parents : 1 ,
182
176
interior : Here ,
183
177
} => true ,
184
- // System parachain
185
- MultiLocation {
186
- parents : 1 ,
187
- interior : X1 ( Parachain ( id) ) ,
188
- } => ParaId :: from ( * id) . is_system ( ) ,
189
178
// Others
190
179
_ => false ,
191
180
} ;
192
181
matches ! ( asset. id, Concrete ( id) if id == KusamaLocation :: get( ) ) && is_system
193
182
}
194
183
}
195
184
196
- /// Cases where a remote origin is accepted as trusted Teleporter for a given asset:
197
- /// - Kusama with the parent Relay Chain and system parachains.
198
- pub type TrustedTeleporters = KusamaAndSystemAsset ;
185
+ /// As this is not a system parachain, there are no trusted teleporters.
186
+ pub type TrustedTeleporters = ( ) ;
187
+
188
+ /// The parent relay chain is the accepted reserve for the native asset.
189
+ pub type TrustedReserve = ParentRelayChainAndAsset ;
199
190
200
191
#[ cfg( feature = "runtime-benchmarks" ) ]
201
192
parameter_types ! {
@@ -212,7 +203,7 @@ impl pallet_xcm::Config for Runtime {
212
203
// Needs to be `Everything` for local testing.
213
204
type XcmExecutor = XcmExecutor < XcmConfig > ;
214
205
type XcmTeleportFilter = Everything ;
215
- type XcmReserveTransferFilter = Nothing ;
206
+ type XcmReserveTransferFilter = Everything ;
216
207
type Weigher = FixedWeightBounds < UnitWeightCost , RuntimeCall , MaxInstructions > ;
217
208
type UniversalLocation = UniversalLocation ;
218
209
type RuntimeOrigin = RuntimeOrigin ;
0 commit comments