Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Some late fixes for XCMv3 #5237

Merged
merged 17 commits into from
Oct 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tighten barriers (ClearOrigin/QueryResponse)
gavofyork committed May 26, 2022
commit bd19b1fbd8287d22d8d2c987f61469219e79a3e2
6 changes: 5 additions & 1 deletion xcm/xcm-builder/src/barriers.rs
Original file line number Diff line number Diff line change
@@ -75,7 +75,10 @@ impl<T: Contains<MultiLocation>> ShouldExecute for AllowTopLevelPaidExecutionFro
);

ensure!(T::contains(origin), ());
let mut iter = instructions.iter_mut();
// We will read up to 5 instructions. This allows up to 3 `ClearOrigin`s instructions. We
// allow for more than one since anything beyond the first is a no-op and it's conceivable
// that composition of operations might result in more than one being appended.
let mut iter = instructions.iter_mut().take(5);
let i = iter.next().ok_or(())?;
match i {
ReceiveTeleportedAsset(..) |
@@ -271,6 +274,7 @@ impl<ResponseHandler: OnResponse> ShouldExecute for AllowKnownQueryResponses<Res
"AllowKnownQueryResponses origin: {:?}, instructions: {:?}, max_weight: {:?}, weight_credit: {:?}",
origin, instructions, _max_weight, _weight_credit,
);
ensure!(instructions.len() == 1, ());
match instructions.first() {
Some(QueryResponse { query_id, querier, .. })
if ResponseHandler::expecting_response(origin, *query_id, querier.as_ref()) =>