Companion for paritytech/polkadot#7098 (#2469)

* Companion for paritytech/polkadot#7098

* Fixes

* Add missing benchmarked function

* Fix typo

* update lockfile for {"polkadot", "substrate"}

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Keith Yeung
2023-04-27 18:48:22 +08:00
committed by GitHub
parent 56aa147284
commit cf4a6efbbd
10 changed files with 337 additions and 271 deletions
+9 -9
View File
@@ -5,20 +5,20 @@ use super::{
use core::{marker::PhantomData, ops::ControlFlow};
use frame_support::{
log, match_types, parameter_types,
traits::{ConstU32, Everything, Nothing},
traits::{ConstU32, Everything, Nothing, ProcessMessageError},
weights::Weight,
};
use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use polkadot_parachain::primitives::Sibling;
use polkadot_runtime_common::impls::ToAuthor;
use xcm::{latest::prelude::*, CreateMatcher, MatchXcm};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom,
CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, NativeAsset, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, WithComputedOrigin,
CreateMatcher, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, MatchXcm,
NativeAsset, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin,
};
use xcm_executor::{traits::ShouldExecute, XcmExecutor};
@@ -108,7 +108,7 @@ where
message: &mut [Instruction<RuntimeCall>],
max_weight: Weight,
weight_credit: &mut Weight,
) -> Result<(), ()> {
) -> Result<(), ProcessMessageError> {
Deny::should_execute(origin, message, max_weight, weight_credit)?;
Allow::should_execute(origin, message, max_weight, weight_credit)
}
@@ -122,7 +122,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
message: &mut [Instruction<RuntimeCall>],
_max_weight: Weight,
_weight_credit: &mut Weight,
) -> Result<(), ()> {
) -> Result<(), ProcessMessageError> {
message.matcher().match_next_inst_while(
|_| true,
|inst| match inst {
@@ -136,7 +136,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
TransferReserveAsset {
dest: MultiLocation { parents: 1, interior: Here }, ..
} => {
Err(()) // Deny
Err(ProcessMessageError::Unsupported) // Deny
},
// An unexpected reserve transfer has arrived from the Relay Chain. Generally,
// `IsReserve` should not allow this, but we just log it here.