-log=info,xcm=traceEntry: https://sourcegraph.com/github.com/paritytech/[email protected]/-/blob/xcm/xcm-executor/src/lib.rs?L68&subtree=true
XCM Barrier: https://sourcegraph.com/github.com/paritytech/polkadot@ef71ed8baef3007b039cdf040d24f5958edb390b/-/blob/xcm/xcm-executor/src/lib.rs?L113&subtree=true
If all barriers failed, print log and return error:
log::debug!(
target: "xcm::execute_xcm_in_credit",
"Barrier blocked execution! Error: {:?}. (origin: {:?}, message: {:?}, weight_limit: {:?}, weight_credit: {:?})",
e,
origin,
message,
weight_limit,
weight_credit,
);
such as:
xcm::execute_xcm_in_credit: [Relaychain] Barrier blocked execution!Error: ().
should_execute trait: https://sourcegraph.com/github.com/paritytech/polkadot@ef71ed8baef3007b039cdf040d24f5958edb390b/-/blob/xcm/xcm-executor/src/traits/should_execute.rs?L34&subtree=true#tab=references
Implement trait for Tuple (Rust built-in type) https://sourcegraph.com/github.com/paritytech/polkadot@ef71ed8baef3007b039cdf040d24f5958edb390b/-/blob/xcm/xcm-executor/src/traits/should_execute.rs?L43
for_tuples!() call each barrier should_execute in Tuplefor_tuples!( #(
match Tuple::should_execute(origin, message, max_weight, weight_credit) {
Ok(()) => return Ok(()),
_ => (),
}
)* );
should_execute implementations, also types of barrier: https://sourcegraph.com/github.com/paritytech/polkadot@ef71ed8baef3007b039cdf040d24f5958edb390b/-/blob/xcm/xcm-builder/src/barriers.rs?L32:5-32:19
TakeWeightCredit
max_weight from weight_credit weight_credit -= max_weightAllowTopLevelPaidExecutionFrom
TeleportAsset, WithdrawAsset, ClaimAsset and ReserveAssetDeposit XCMsTeleportAsset , WithdrawAsset, ClaimAsset and ReserveAssetDepositClearOriginBuyExecutionAllowUnpaidExecutionFrom
ensure!(T::contains(origin), ());AllowUnpaidExecutionFrom<IsInVec<AllowUnpaidFrom>> Only allow call origin is IsInVec<AllowUnpaidFrom>>AllowTopLevelPaidExecutionFromIsChildSystemParachain
AllowKnownQueryResponses
ResponseHandler::expecting_responseAllowSubscriptionsFrom
origin if it is just a straight SubscribeVerison or UnsubscribeVersion instruction.SubscribeVerison or UnsubscribeVersionRococo barrier config: https://sourcegraph.com/github.com/paritytech/polkadot@ef71ed8baef3007b039cdf040d24f5958edb390b/-/blob/runtime/rococo/src/xcm_config.rs?L112&subtree=true
use xcm_builder::{AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, TakeWeightCredit};
pub type Barrier = (
TakeWeightCredit,
AllowTopLevelPaidExecutionFrom<Everything>,
AllowUnpaidExecutionFrom<IsInVec<AllowUnpaidFrom>>, // <- Trusted parachains get free execution
// Expected responses are OK.
AllowKnownQueryResponses<XcmPallet>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<Everything>,
);
Moonbeam barrier config: https://sourcegraph.com/github.com/PureStake/moonbeam@8369da6dd073e1dc757deda2a778648c15c8298e/-/blob/runtime/moonbase/src/xcm_config.rs?L223
pub type XcmBarrier = (
TakeWeightCredit,
AllowTopLevelPaidExecutionFrom<Everything>,
AllowKnownQueryResponses<PolkadotXcm>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<Everything>,
);
If pass barrier, XcmExecutor.execute will execute XCM instructions https://sourcegraph.com/github.com/paritytech/polkadot@ef71ed8baef3007b039cdf040d24f5958edb390b/-/blob/xcm/xcm-executor/src/lib.rs?L131&subtree=true
execute will print log: https://sourcegraph.com/github.com/paritytech/polkadot@ef71ed8baef3007b039cdf040d24f5958edb390b/-/blob/xcm/xcm-executor/src/lib.rs?L187:9&subtree=truexcm::execute: [🌗] origin: ...
After execute, print log xcm::execute_xcm_in_credit https://sourcegraph.com/github.com/paritytech/polkadot@ef71ed8baef3007b039cdf040d24f5958edb390b/-/blob/xcm/xcm-executor/src/lib.rs?L131&subtree=true
xcm::execute_xcm_in_credit: [🌗] result: Ok(())