mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 12:51:02 +00:00
Fix pallet_xcm::execute (#4490)
* Make `pallet_xcm::execute` supply the proper weight credit * Use weight correction Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
committed by
GitHub
parent
550e81b63f
commit
3800b01fe1
@@ -572,15 +572,21 @@ pub mod pallet {
|
||||
origin: OriginFor<T>,
|
||||
message: Box<VersionedXcm<<T as SysConfig>::Call>>,
|
||||
max_weight: Weight,
|
||||
) -> DispatchResult {
|
||||
) -> DispatchResultWithPostInfo {
|
||||
let origin_location = T::ExecuteXcmOrigin::ensure_origin(origin)?;
|
||||
let message = (*message).try_into().map_err(|()| Error::<T>::BadVersion)?;
|
||||
let value = (origin_location, message);
|
||||
ensure!(T::XcmExecuteFilter::contains(&value), Error::<T>::Filtered);
|
||||
let (origin_location, message) = value;
|
||||
let outcome = T::XcmExecutor::execute_xcm(origin_location, message, max_weight);
|
||||
let outcome = T::XcmExecutor::execute_xcm_in_credit(
|
||||
origin_location,
|
||||
message,
|
||||
max_weight,
|
||||
max_weight,
|
||||
);
|
||||
let result = Ok(Some(outcome.weight_used().saturating_add(100_000_000)).into());
|
||||
Self::deposit_event(Event::Attempted(outcome));
|
||||
Ok(())
|
||||
result
|
||||
}
|
||||
|
||||
/// Extoll that a particular destination can be communicated with through a particular
|
||||
|
||||
Reference in New Issue
Block a user