Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
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
Next Next commit
Remove BuyExecution::orders
  • Loading branch information
gavofyork committed Aug 14, 2021
commit 62d76b42d2408c2898d46f50c51e510044936bf1
2 changes: 0 additions & 2 deletions xcm/pallet-xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ pub mod pallet {
weight: 0,
debt: dest_weight,
halt_on_error: false,
orders: vec![],
instructions: vec![],
},
DepositAsset { assets: Wild(All), max_assets, beneficiary: *beneficiary },
Expand Down Expand Up @@ -259,7 +258,6 @@ pub mod pallet {
weight: 0,
debt: dest_weight, // covers this, `TransferReserveAsset` xcm, and `DepositAsset` order.
halt_on_error: false,
orders: vec![],
instructions: vec![],
},
DepositAsset { assets: Wild(All), max_assets, beneficiary: *beneficiary },
Expand Down
1 change: 0 additions & 1 deletion xcm/pallet-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ pub(crate) fn buy_execution<C>(fees: impl Into<MultiAsset>, debt: Weight) -> Ord
weight: 0,
debt,
halt_on_error: false,
orders: vec![],
instructions: vec![],
}
}
Expand Down
9 changes: 2 additions & 7 deletions xcm/src/v1/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ pub enum Order<Call> {
/// any surrounding operations/orders.
/// - `halt_on_error`: If `true`, the execution of the `orders` and `operations` will halt on the first failure. If
/// `false`, then execution will continue regardless.
/// - `orders`: Orders to be executed with the existing Holding Register; execution of these orders happens PRIOR to
/// execution of the `operations`. The (shallow) weight for these must be paid for with the `weight` purchased.
/// - `instructions`: XCM instructions to be executed outside of the context of the current Holding Register;
/// execution of these instructions happens AFTER the execution of the `orders`. The (shallow) weight for these
/// must be paid for with the `weight` purchased.
Expand All @@ -152,7 +150,6 @@ pub enum Order<Call> {
weight: u64,
debt: u64,
halt_on_error: bool,
orders: Vec<Order<Call>>,
instructions: Vec<Xcm<Call>>,
},
}
Expand All @@ -179,10 +176,9 @@ impl<Call> Order<Call> {
InitiateTeleport { assets, dest, effects } =>
InitiateTeleport { assets, dest, effects },
QueryHolding { query_id, dest, assets } => QueryHolding { query_id, dest, assets },
BuyExecution { fees, weight, debt, halt_on_error, orders, instructions } => {
let orders = orders.into_iter().map(Order::from).collect();
BuyExecution { fees, weight, debt, halt_on_error, instructions } => {
let instructions = instructions.into_iter().map(Xcm::from).collect();
BuyExecution { fees, weight, debt, halt_on_error, orders, instructions }
BuyExecution { fees, weight, debt, halt_on_error, instructions }
},
}
}
Expand Down Expand Up @@ -237,7 +233,6 @@ impl<Call> TryFrom<Order0<Call>> for Order<Call> {
weight,
debt,
halt_on_error,
orders: vec![],
instructions,
}
},
Expand Down
5 changes: 0 additions & 5 deletions xcm/xcm-builder/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ fn weigher_should_work() {
weight: 0,
debt: 30,
halt_on_error: true,
orders: vec![],
instructions: vec![],
},
Order::DepositAsset { assets: All.into(), max_assets: 1, beneficiary: Here.into() },
Expand Down Expand Up @@ -139,7 +138,6 @@ fn allow_paid_should_work() {
weight: 0,
debt: 20,
halt_on_error: true,
orders: vec![],
instructions: vec![],
},
Order::DepositAsset { assets: All.into(), max_assets: 1, beneficiary: Here.into() },
Expand All @@ -164,7 +162,6 @@ fn allow_paid_should_work() {
weight: 0,
debt: 30,
halt_on_error: true,
orders: vec![],
instructions: vec![],
},
Order::DepositAsset { assets: All.into(), max_assets: 1, beneficiary: Here.into() },
Expand Down Expand Up @@ -206,7 +203,6 @@ fn paying_reserve_deposit_should_work() {
weight: 0,
debt: 30,
halt_on_error: true,
orders: vec![],
instructions: vec![],
},
Order::<TestCall>::DepositAsset {
Expand Down Expand Up @@ -347,7 +343,6 @@ fn paid_transacting_should_refund_payment_for_unused_weight() {
weight: 70,
debt: 30,
halt_on_error: true,
orders: vec![],
instructions: vec![Xcm::<TestCall>::Transact {
origin_type: OriginKind::Native,
require_weight_at_most: 60,
Expand Down
5 changes: 0 additions & 5 deletions xcm/xcm-builder/src/weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ impl<T: Get<Weight>, C: Decode + GetDispatchInfo> FixedWeightBounds<T, C> {
Self::shallow(instruction)?.saturating_add(Self::deep(instruction)?),
);
}
for order in orders.iter_mut() {
extra.saturating_accrue(
Self::shallow_order(order)?.saturating_add(Self::deep_order(order)?),
);
}
extra
},
_ => 0,
Expand Down
2 changes: 0 additions & 2 deletions xcm/xcm-executor/integration-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ fn execute_within_recursion_limit() {
weight: 0,
debt: 0,
halt_on_error: true,
orders: vec![],
// nest `msg` into itself on each iteration.
instructions: vec![msg],
}],
Expand Down Expand Up @@ -101,7 +100,6 @@ fn exceed_recursion_limit() {
weight: 0,
debt: 0,
halt_on_error: true,
orders: vec![],
// nest `msg` into itself on each iteration.
instructions: vec![msg],
}],
Expand Down
9 changes: 1 addition & 8 deletions xcm/xcm-executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
Xcm::QueryResponse { query_id, response: Response::Assets(assets) },
)?;
},
Order::BuyExecution { fees, weight, debt, halt_on_error, orders, instructions } => {
Order::BuyExecution { fees, weight, debt, halt_on_error, instructions } => {
// pay for `weight` using up to `fees` of the holding register.
let purchasing_weight =
Weight::from(weight.checked_add(debt).ok_or(XcmError::Overflow)?);
Expand All @@ -342,13 +342,6 @@ impl<Config: config::Config> XcmExecutor<Config> {
holding.subsume_assets(unspent);

let mut remaining_weight = weight;
for order in orders.into_iter() {
match Self::execute_orders(origin, holding, order, trader, num_recursions + 1) {
Err(e) if halt_on_error => return Err(e),
Err(_) => {},
Ok(surplus) => total_surplus += surplus,
}
}
for instruction in instructions.into_iter() {
match Self::do_execute_xcm(
origin.clone(),
Expand Down