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

Commit e3bf763

Browse files
gavofyorkchevdor
authored andcommitted
Remove BuyExecution::orders (#3640)
* Remove BuyExecution::orders * Fixes * Fixes * Fixes * Formatting
1 parent 11bcd5e commit e3bf763

8 files changed

Lines changed: 7 additions & 43 deletions

File tree

xcm/pallet-xcm/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ pub mod pallet {
186186
weight: 0,
187187
debt: dest_weight,
188188
halt_on_error: false,
189-
orders: vec![],
190189
instructions: vec![],
191190
},
192191
DepositAsset { assets: Wild(All), max_assets, beneficiary },
@@ -255,7 +254,6 @@ pub mod pallet {
255254
weight: 0,
256255
debt: dest_weight, // covers this, `TransferReserveAsset` xcm, and `DepositAsset` order.
257256
halt_on_error: false,
258-
orders: vec![],
259257
instructions: vec![],
260258
},
261259
DepositAsset { assets: Wild(All), max_assets, beneficiary },

xcm/pallet-xcm/src/mock.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ pub(crate) fn buy_execution<C>(fees: impl Into<MultiAsset>, debt: Weight) -> Ord
198198
weight: 0,
199199
debt,
200200
halt_on_error: false,
201-
orders: vec![],
202201
instructions: vec![],
203202
}
204203
}

xcm/src/v0/order.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,7 @@ impl<Call> TryFrom<Order1<Call>> for Order<Call> {
194194
},
195195
Order1::QueryHolding { query_id, dest, assets } =>
196196
QueryHolding { query_id, dest: dest.try_into()?, assets: assets.try_into()? },
197-
Order1::BuyExecution { fees, weight, debt, halt_on_error, orders, instructions } => {
198-
if !orders.is_empty() {
199-
return Err(())
200-
}
197+
Order1::BuyExecution { fees, weight, debt, halt_on_error, instructions } => {
201198
let xcm = instructions
202199
.into_iter()
203200
.map(Xcm::<Call>::try_from)

xcm/src/v1/order.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use super::{
2020
super::v0::Order as Order0, MultiAsset, MultiAssetFilter, MultiAssets, MultiLocation, Xcm,
2121
};
22-
use alloc::{vec, vec::Vec};
22+
use alloc::vec::Vec;
2323
use core::{
2424
convert::{TryFrom, TryInto},
2525
result,
@@ -140,8 +140,6 @@ pub enum Order<Call> {
140140
/// any surrounding operations/orders.
141141
/// - `halt_on_error`: If `true`, the execution of the `orders` and `operations` will halt on the first failure. If
142142
/// `false`, then execution will continue regardless.
143-
/// - `orders`: Orders to be executed with the existing Holding Register; execution of these orders happens PRIOR to
144-
/// execution of the `operations`. The (shallow) weight for these must be paid for with the `weight` purchased.
145143
/// - `instructions`: XCM instructions to be executed outside of the context of the current Holding Register;
146144
/// execution of these instructions happens AFTER the execution of the `orders`. The (shallow) weight for these
147145
/// must be paid for with the `weight` purchased.
@@ -152,7 +150,6 @@ pub enum Order<Call> {
152150
weight: u64,
153151
debt: u64,
154152
halt_on_error: bool,
155-
orders: Vec<Order<Call>>,
156153
instructions: Vec<Xcm<Call>>,
157154
},
158155
}
@@ -179,10 +176,9 @@ impl<Call> Order<Call> {
179176
InitiateTeleport { assets, dest, effects } =>
180177
InitiateTeleport { assets, dest, effects },
181178
QueryHolding { query_id, dest, assets } => QueryHolding { query_id, dest, assets },
182-
BuyExecution { fees, weight, debt, halt_on_error, orders, instructions } => {
183-
let orders = orders.into_iter().map(Order::from).collect();
179+
BuyExecution { fees, weight, debt, halt_on_error, instructions } => {
184180
let instructions = instructions.into_iter().map(Xcm::from).collect();
185-
BuyExecution { fees, weight, debt, halt_on_error, orders, instructions }
181+
BuyExecution { fees, weight, debt, halt_on_error, instructions }
186182
},
187183
}
188184
}
@@ -232,14 +228,7 @@ impl<Call> TryFrom<Order0<Call>> for Order<Call> {
232228
Order0::BuyExecution { fees, weight, debt, halt_on_error, xcm } => {
233229
let instructions =
234230
xcm.into_iter().map(Xcm::<Call>::try_from).collect::<result::Result<_, _>>()?;
235-
BuyExecution {
236-
fees: fees.try_into()?,
237-
weight,
238-
debt,
239-
halt_on_error,
240-
orders: vec![],
241-
instructions,
242-
}
231+
BuyExecution { fees: fees.try_into()?, weight, debt, halt_on_error, instructions }
243232
},
244233
})
245234
}

xcm/xcm-builder/src/tests.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ fn weigher_should_work() {
5151
weight: 0,
5252
debt: 30,
5353
halt_on_error: true,
54-
orders: vec![],
5554
instructions: vec![],
5655
},
5756
Order::DepositAsset { assets: All.into(), max_assets: 1, beneficiary: Here.into() },
@@ -139,7 +138,6 @@ fn allow_paid_should_work() {
139138
weight: 0,
140139
debt: 20,
141140
halt_on_error: true,
142-
orders: vec![],
143141
instructions: vec![],
144142
},
145143
Order::DepositAsset { assets: All.into(), max_assets: 1, beneficiary: Here.into() },
@@ -164,7 +162,6 @@ fn allow_paid_should_work() {
164162
weight: 0,
165163
debt: 30,
166164
halt_on_error: true,
167-
orders: vec![],
168165
instructions: vec![],
169166
},
170167
Order::DepositAsset { assets: All.into(), max_assets: 1, beneficiary: Here.into() },
@@ -206,7 +203,6 @@ fn paying_reserve_deposit_should_work() {
206203
weight: 0,
207204
debt: 30,
208205
halt_on_error: true,
209-
orders: vec![],
210206
instructions: vec![],
211207
},
212208
Order::<TestCall>::DepositAsset {
@@ -347,7 +343,6 @@ fn paid_transacting_should_refund_payment_for_unused_weight() {
347343
weight: 70,
348344
debt: 30,
349345
halt_on_error: true,
350-
orders: vec![],
351346
instructions: vec![Xcm::<TestCall>::Transact {
352347
origin_type: OriginKind::Native,
353348
require_weight_at_most: 60,

xcm/xcm-builder/src/weight.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,13 @@ impl<T: Get<Weight>, C: Decode + GetDispatchInfo> FixedWeightBounds<T, C> {
8080
}
8181
fn deep_order(order: &mut Order<C>) -> Result<Weight, ()> {
8282
Ok(match order {
83-
Order::BuyExecution { orders, instructions, .. } => {
83+
Order::BuyExecution { instructions, .. } => {
8484
let mut extra = 0;
8585
for instruction in instructions.iter_mut() {
8686
extra.saturating_accrue(
8787
Self::shallow(instruction)?.saturating_add(Self::deep(instruction)?),
8888
);
8989
}
90-
for order in orders.iter_mut() {
91-
extra.saturating_accrue(
92-
Self::shallow_order(order)?.saturating_add(Self::deep_order(order)?),
93-
);
94-
}
9590
extra
9691
},
9792
_ => 0,

xcm/xcm-executor/integration-tests/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ fn execute_within_recursion_limit() {
4646
weight: 0,
4747
debt: 0,
4848
halt_on_error: true,
49-
orders: vec![],
5049
// nest `msg` into itself on each iteration.
5150
instructions: vec![msg],
5251
}],
@@ -101,7 +100,6 @@ fn exceed_recursion_limit() {
101100
weight: 0,
102101
debt: 0,
103102
halt_on_error: true,
104-
orders: vec![],
105103
// nest `msg` into itself on each iteration.
106104
instructions: vec![msg],
107105
}],

xcm/xcm-executor/src/lib.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
332332
Xcm::QueryResponse { query_id, response: Response::Assets(assets) },
333333
)?;
334334
},
335-
Order::BuyExecution { fees, weight, debt, halt_on_error, orders, instructions } => {
335+
Order::BuyExecution { fees, weight, debt, halt_on_error, instructions } => {
336336
// pay for `weight` using up to `fees` of the holding register.
337337
let purchasing_weight =
338338
Weight::from(weight.checked_add(debt).ok_or(XcmError::Overflow)?);
@@ -342,13 +342,6 @@ impl<Config: config::Config> XcmExecutor<Config> {
342342
holding.subsume_assets(unspent);
343343

344344
let mut remaining_weight = weight;
345-
for order in orders.into_iter() {
346-
match Self::execute_orders(origin, holding, order, trader, num_recursions + 1) {
347-
Err(e) if halt_on_error => return Err(e),
348-
Err(_) => {},
349-
Ok(surplus) => total_surplus += surplus,
350-
}
351-
}
352345
for instruction in instructions.into_iter() {
353346
match Self::do_execute_xcm(
354347
origin.clone(),

0 commit comments

Comments
 (0)