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

Barrier should be able to deny certain XCMs from happening explicitly #837

Open
gilescope opened this issue Apr 19, 2022 · 1 comment
Open
Labels
T6-XCM This PR/Issue is related to XCM.

Comments

@gilescope
Copy link
Contributor

We currently have a set of allow rules that will let certain messages through using the ShouldExecute tuple.

The suggestion is to have a guard that ensures that any matching message is denied:

pub struct DenyThenTry<Deny, Allow>(PhantomData<Deny>, PhantomData<Allow>)
where
	Deny: ShouldExecute,
	Allow: ShouldExecute;

impl<Deny, Allow> ShouldExecute for DenyThenTry<Deny, Allow>
where
	Deny: ShouldExecute,
	Allow: ShouldExecute,
{
	fn should_execute<Call>(
		origin: &MultiLocation,
		message: &mut Xcm<Call>,
		max_weight: Weight,
		weight_credit: &mut Weight,
	) -> Result<(), ()> {
		Deny::should_execute(origin, message, max_weight, weight_credit)?;
		Allow::should_execute(origin, message, max_weight, weight_credit)
	}
}

At the moment DenyThenTry<(),(.....)> would always deny with the empty tuple because it returns Err() on nothing matched.

Keith mentioned that returning NoRulesMatched from RejectReason that paritytech/polkadot#5035 is introducing might help. It might be clearer if we had an opposite of the ShouldExecute trait.

@gilescope
Copy link
Contributor Author

Supporting a mechanism of this ilk should mean that we can delete code introduced in cumulus PR: paritytech/cumulus#1169

@Sophia-Gold Sophia-Gold transferred this issue from paritytech/polkadot Aug 24, 2023
claravanstaden pushed a commit to Snowfork/polkadot-sdk that referenced this issue Dec 8, 2023
@franciscoaguirre franciscoaguirre added the T6-XCM This PR/Issue is related to XCM. label Mar 25, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
bkchr pushed a commit that referenced this issue Apr 10, 2024
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T6-XCM This PR/Issue is related to XCM.
Projects
None yet
Development

No branches or pull requests

2 participants