Skip to content

Commit

Permalink
Test xcm message export is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
dimartiro committed Jan 22, 2025
1 parent e6804f7 commit 703e5af
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
mod constants;
mod mocknets;
mod reserver_transfers_polkadot_xcm;
mod xcm_message_exporter;
pub use xcm_emulator::{bx, TestExt};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use {
super::{
super::{AccountId, ExtBuilder, ALICE},
mocknets::{DancelightRelay as Dancelight, DancelightRelayPallet},
},
frame_support::weights::Weight,
pallet_xcm::Error,
sp_runtime::DispatchError,
xcm::{latest::prelude::*, VersionedXcm},
xcm_emulator::Chain,
};

#[test]
fn test_message_export_disabled() {
ExtBuilder::default().build().execute_with(|| {
// The only test we can do is with signed runtime origins since we are ensuring local origin in xcm config
let origin = <Dancelight as Chain>::RuntimeOrigin::signed(AccountId::from(ALICE));

let message = Xcm(vec![Instruction::ExportMessage {
network: NetworkId::Ethereum { chain_id: 1 },
destination: Junctions::Here.into(),
xcm: Xcm(vec![]),
}]);

assert_eq!(
<Dancelight as DancelightRelayPallet>::XcmPallet::execute(
origin,
Box::new(VersionedXcm::V4(message)),
Weight::from_parts(0, 0)
)
.unwrap_err()
.error,
DispatchError::from(Error::<<Dancelight as Chain>::Runtime>::LocalExecutionIncomplete)
);
});
}

0 comments on commit 703e5af

Please sign in to comment.