mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 23:15:42 +00:00
Fix use of weight limit errors (#4358)
This commit is contained in:
@@ -56,12 +56,12 @@ pub enum Error {
|
|||||||
/// An asset wildcard was passed where it was not expected (e.g. as the asset to withdraw in a
|
/// An asset wildcard was passed where it was not expected (e.g. as the asset to withdraw in a
|
||||||
/// `WithdrawAsset` XCM).
|
/// `WithdrawAsset` XCM).
|
||||||
Wildcard,
|
Wildcard,
|
||||||
/// The case where an XCM message has specified a optional weight limit and the weight required for
|
/// The case where an XCM message has specified a weight limit on an interior call and this
|
||||||
/// processing is too great.
|
/// limit is too low.
|
||||||
///
|
///
|
||||||
/// Used by:
|
/// Used by:
|
||||||
/// - `Transact`
|
/// - `Transact`
|
||||||
TooMuchWeightRequired,
|
MaxWeightInvalid,
|
||||||
/// The fees specified by the XCM message were not found in the holding account.
|
/// The fees specified by the XCM message were not found in the holding account.
|
||||||
///
|
///
|
||||||
/// Used by:
|
/// Used by:
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ pub enum Error {
|
|||||||
/// An asset wildcard was passed where it was not expected (e.g. as the asset to withdraw in a
|
/// An asset wildcard was passed where it was not expected (e.g. as the asset to withdraw in a
|
||||||
/// `WithdrawAsset` XCM).
|
/// `WithdrawAsset` XCM).
|
||||||
Wildcard,
|
Wildcard,
|
||||||
/// The case where an XCM message has specified a optional weight limit and the weight required for
|
/// The case where an XCM message has specified a weight limit on an interior call and this
|
||||||
/// processing is too great.
|
/// limit is too low.
|
||||||
///
|
///
|
||||||
/// Used by:
|
/// Used by:
|
||||||
/// - `Transact`
|
/// - `Transact`
|
||||||
TooMuchWeightRequired,
|
MaxWeightInvalid,
|
||||||
/// The fees specified by the XCM message were not found in the holding register.
|
/// The fees specified by the XCM message were not found in the holding register.
|
||||||
///
|
///
|
||||||
/// Used by:
|
/// Used by:
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ pub enum Error {
|
|||||||
FailedToDecode,
|
FailedToDecode,
|
||||||
/// Used by `Transact` to indicate that the given weight limit could be breached by the functor.
|
/// Used by `Transact` to indicate that the given weight limit could be breached by the functor.
|
||||||
#[codec(index = 18)]
|
#[codec(index = 18)]
|
||||||
TooMuchWeightRequired,
|
MaxWeightInvalid,
|
||||||
/// Used by `BuyExecution` when the Holding Register does not contain payable fees.
|
/// Used by `BuyExecution` when the Holding Register does not contain payable fees.
|
||||||
#[codec(index = 19)]
|
#[codec(index = 19)]
|
||||||
NotHoldingFees,
|
NotHoldingFees,
|
||||||
|
|||||||
@@ -598,7 +598,7 @@ fn transacting_should_respect_max_weight_requirement() {
|
|||||||
}]);
|
}]);
|
||||||
let weight_limit = 60;
|
let weight_limit = 60;
|
||||||
let r = XcmExecutor::<TestConfig>::execute_xcm(Parent, message, weight_limit);
|
let r = XcmExecutor::<TestConfig>::execute_xcm(Parent, message, weight_limit);
|
||||||
assert_eq!(r, Outcome::Incomplete(50, XcmError::TooMuchWeightRequired));
|
assert_eq!(r, Outcome::Incomplete(50, XcmError::MaxWeightInvalid));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
|
|||||||
let dispatch_origin = Config::OriginConverter::convert_origin(origin, origin_type)
|
let dispatch_origin = Config::OriginConverter::convert_origin(origin, origin_type)
|
||||||
.map_err(|_| XcmError::BadOrigin)?;
|
.map_err(|_| XcmError::BadOrigin)?;
|
||||||
let weight = message_call.get_dispatch_info().weight;
|
let weight = message_call.get_dispatch_info().weight;
|
||||||
ensure!(weight <= require_weight_at_most, XcmError::TooMuchWeightRequired);
|
ensure!(weight <= require_weight_at_most, XcmError::MaxWeightInvalid);
|
||||||
let actual_weight = match message_call.dispatch(dispatch_origin) {
|
let actual_weight = match message_call.dispatch(dispatch_origin) {
|
||||||
Ok(post_info) => post_info.actual_weight,
|
Ok(post_info) => post_info.actual_weight,
|
||||||
Err(error_and_info) => {
|
Err(error_and_info) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user