Skip to content

[XCM] Improve XCM precompile tests #1221

@Dinonard

Description

@Dinonard

Description

With the introduction of remote_transact we need to ensure the message being sent has the correct format. The send extrinsic will prepend XCM with DescendOrigin instruction in case it’s not coming from sovereign account. We rely on it in the precompiles and should somehow ensure it doesn’t accidentally get removed.

An approach that can be used:

thread_local! {
	pub static SENT_XCM: RefCell<Vec<(MultiLocation, Xcm<()>)>> = RefCell::new(Vec::new());
}

/// Sender that never returns error, always sends
pub struct TestSendXcm;
impl SendXcm for TestSendXcm {
	fn send_xcm(dest: impl Into<MultiLocation>, msg: Xcm<()>) -> SendResult {
		SENT_XCM.with(|q| q.borrow_mut().push((dest.into(), msg)));
		Ok(())
	}
}

Metadata

Metadata

Assignees

Labels

projectIssue is part of an ongoing project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions