Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XCM] Improve XCM precompile tests #1221

Open
Dinonard opened this issue Apr 5, 2024 · 0 comments
Open

[XCM] Improve XCM precompile tests #1221

Dinonard opened this issue Apr 5, 2024 · 0 comments
Labels
project Issue is part of an ongoing project

Comments

@Dinonard
Copy link
Member

Dinonard commented Apr 5, 2024

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(())
	}
}
@Dinonard Dinonard added the project Issue is part of an ongoing project label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project Issue is part of an ongoing project
Projects
None yet
Development

No branches or pull requests

1 participant