mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 12:51:02 +00:00
Required weight is returned in case it exceeds limit. (#2952)
This commit is contained in:
@@ -578,7 +578,7 @@ impl MultiLocation {
|
||||
let self_parents = self.parent_count();
|
||||
let prefix_rest = prefix.len() - prefix.parent_count();
|
||||
let skipped = self_parents.min(prefix_rest);
|
||||
if self.len() + prefix.len() - 2 * skipped > 4 {
|
||||
if self.len() + prefix.len() - 2 * skipped > 8 {
|
||||
return Err(prefix);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,9 @@ pub enum Error {
|
||||
BadOrigin,
|
||||
ExceedsMaxMessageSize,
|
||||
FailedToTransactAsset(#[codec(skip)] &'static str),
|
||||
WeightLimitReached,
|
||||
/// Execution of the XCM would potentially result in a greater weight used than the pre-specified
|
||||
/// weight limit. The amount that is potentially required is the parameter.
|
||||
WeightLimitReached(Weight),
|
||||
Wildcard,
|
||||
/// The case where an XCM message has specified a optional weight limit and the weight required for
|
||||
/// processing is too great.
|
||||
|
||||
@@ -54,10 +54,10 @@ impl<Config: config::Config> ExecuteXcm<Config::Call> for XcmExecutor<Config> {
|
||||
};
|
||||
let maximum_weight = match shallow_weight.checked_add(deep_weight) {
|
||||
Some(x) => x,
|
||||
None => return Outcome::Error(XcmError::WeightLimitReached),
|
||||
None => return Outcome::Error(XcmError::Overflow),
|
||||
};
|
||||
if maximum_weight > weight_limit {
|
||||
return Outcome::Error(XcmError::WeightLimitReached);
|
||||
return Outcome::Error(XcmError::WeightLimitReached(maximum_weight));
|
||||
}
|
||||
let mut trader = Config::Trader::new();
|
||||
let result = Self::do_execute_xcm(origin, true, message, &mut 0, Some(shallow_weight), &mut trader);
|
||||
|
||||
Reference in New Issue
Block a user