mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 18:41:03 +00:00
Bound number of assets which can be withdrawn to pay for execution. (#7641)
* Bound number of assets which can be withdrawn to pay for execution. * ".git/.scripts/commands/fmt/fmt.sh" * Include ClaimAsset in limiting the assets * Change max assets to constant --------- Co-authored-by: command-bot <> Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
This commit is contained in:
@@ -52,6 +52,8 @@ impl ShouldExecute for TakeWeightCredit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MAX_ASSETS_FOR_BUY_EXECUTION: usize = 1;
|
||||||
|
|
||||||
/// Allows execution from `origin` if it is contained in `T` (i.e. `T::Contains(origin)`) taking
|
/// Allows execution from `origin` if it is contained in `T` (i.e. `T::Contains(origin)`) taking
|
||||||
/// payments into account.
|
/// payments into account.
|
||||||
///
|
///
|
||||||
@@ -79,10 +81,10 @@ impl<T: Contains<MultiLocation>> ShouldExecute for AllowTopLevelPaidExecutionFro
|
|||||||
instructions[..end]
|
instructions[..end]
|
||||||
.matcher()
|
.matcher()
|
||||||
.match_next_inst(|inst| match inst {
|
.match_next_inst(|inst| match inst {
|
||||||
ReceiveTeleportedAsset(..) |
|
ReceiveTeleportedAsset(..) | ReserveAssetDeposited(..) => Ok(()),
|
||||||
WithdrawAsset(..) |
|
WithdrawAsset(ref assets) if assets.len() <= MAX_ASSETS_FOR_BUY_EXECUTION => Ok(()),
|
||||||
ReserveAssetDeposited(..) |
|
ClaimAsset { ref assets, .. } if assets.len() <= MAX_ASSETS_FOR_BUY_EXECUTION =>
|
||||||
ClaimAsset { .. } => Ok(()),
|
Ok(()),
|
||||||
_ => Err(ProcessMessageError::BadFormat),
|
_ => Err(ProcessMessageError::BadFormat),
|
||||||
})?
|
})?
|
||||||
.skip_inst_while(|inst| matches!(inst, ClearOrigin))?
|
.skip_inst_while(|inst| matches!(inst, ClearOrigin))?
|
||||||
|
|||||||
Reference in New Issue
Block a user