@@ -20,13 +20,15 @@ use bp_asset_hub_westend::ASSET_HUB_WESTEND_PARACHAIN_ID;
20
20
use bp_bridge_hub_westend:: BRIDGE_HUB_WESTEND_PARACHAIN_ID ;
21
21
use bp_polkadot_core:: Signature ;
22
22
use bridge_hub_westend_runtime:: {
23
- bridge_to_rococo_config, xcm_config:: XcmConfig , AllPalletsWithoutSystem ,
24
- BridgeRejectObsoleteHeadersAndMessages , Executive , MessageQueueServiceWeight , Runtime ,
25
- RuntimeCall , RuntimeEvent , SessionKeys , TxExtension , UncheckedExtrinsic ,
23
+ bridge_to_rococo_config,
24
+ xcm_config:: { Barrier , XcmConfig } ,
25
+ AllPalletsWithoutSystem , BridgeRejectObsoleteHeadersAndMessages , Executive ,
26
+ MessageQueueServiceWeight , Runtime , RuntimeCall , RuntimeEvent , SessionKeys , TxExtension ,
27
+ UncheckedExtrinsic ,
26
28
} ;
27
29
use codec:: { Decode , Encode } ;
28
30
use cumulus_primitives_core:: XcmError :: { FailedToTransactAsset , NotHoldingFees } ;
29
- use frame_support:: parameter_types;
31
+ use frame_support:: { assert_err , parameter_types, traits :: ProcessMessageError } ;
30
32
use parachains_common:: { AccountId , AuraId , Balance } ;
31
33
use snowbridge_pallet_ethereum_client:: WeightInfo ;
32
34
use sp_core:: H160 ;
@@ -35,9 +37,15 @@ use sp_runtime::{
35
37
generic:: { Era , SignedPayload } ,
36
38
AccountId32 ,
37
39
} ;
40
+ use xcm:: prelude:: {
41
+ All , AssetFilter , DepositReserveAsset , Here , Instruction , Location , Parachain , Weight , Wild ,
42
+ XcmError ,
43
+ } ;
44
+ use xcm_executor:: traits:: { Properties , ShouldExecute } ;
38
45
39
46
parameter_types ! {
40
47
pub const DefaultBridgeHubEthereumBaseFee : Balance = 2_750_872_500_000 ;
48
+ pub AssetHubLocation : Location = Location :: new( 1 , Parachain ( ASSET_HUB_WESTEND_PARACHAIN_ID ) ) ;
41
49
}
42
50
43
51
fn collator_session_keys ( ) -> bridge_hub_test_utils:: CollatorSessionKeys < Runtime > {
@@ -200,3 +208,36 @@ fn construct_and_apply_extrinsic(
200
208
let r = Executive :: apply_extrinsic ( xt) ;
201
209
r. unwrap ( )
202
210
}
211
+
212
+ #[ test]
213
+ pub fn transfer_token_to_ethereum_from_source_other_than_asset_hub_failure ( ) {
214
+ snowbridge_runtime_test_common:: send_transfer_token_message_from_source_other_than_asset_hub_failure :: < Runtime , XcmConfig > (
215
+ 11155111 ,
216
+ collator_session_keys ( ) ,
217
+ BRIDGE_HUB_WESTEND_PARACHAIN_ID ,
218
+ ASSET_HUB_WESTEND_PARACHAIN_ID ,
219
+ 2000 ,
220
+ DefaultBridgeHubEthereumBaseFee :: get ( ) ,
221
+ H160 :: random ( ) ,
222
+ H160 :: random ( ) ,
223
+ DefaultBridgeHubEthereumBaseFee :: get ( ) ,
224
+ XcmError :: Barrier ,
225
+ )
226
+ }
227
+
228
+ #[ test]
229
+ fn deny_reserve_transfer_to_relay_chain ( ) {
230
+ let mut xcm: Vec < Instruction < ( ) > > = vec ! [ DepositReserveAsset {
231
+ assets: AssetFilter :: try_from( Wild ( All ) ) . unwrap( ) ,
232
+ dest: Location { parents: 1 , interior: Here } ,
233
+ xcm: Default :: default ( ) ,
234
+ } ] ;
235
+
236
+ let result = Barrier :: should_execute (
237
+ & AssetHubLocation :: get ( ) ,
238
+ & mut xcm,
239
+ Weight :: zero ( ) ,
240
+ & mut Properties { weight_credit : Weight :: zero ( ) , message_id : None } ,
241
+ ) ;
242
+ assert_err ! ( result, ProcessMessageError :: Unsupported ) ;
243
+ }
0 commit comments