mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Merge remote-tracking branch 'origin/master' into gav-xcm-v3
This commit is contained in:
@@ -55,7 +55,10 @@ use rand_chacha::{
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::RuntimeDebug;
|
||||
use sp_std::{convert::TryFrom, prelude::*};
|
||||
use xcm::{latest::prelude::*, VersionedXcm, WrapVersion, MAX_XCM_DECODE_DEPTH};
|
||||
use xcm::{
|
||||
latest::{prelude::*, Weight as XcmWeight},
|
||||
VersionedXcm, WrapVersion, MAX_XCM_DECODE_DEPTH,
|
||||
};
|
||||
use xcm_executor::traits::ConvertOrigin;
|
||||
|
||||
pub use pallet::*;
|
||||
@@ -64,6 +67,7 @@ pub use pallet::*;
|
||||
pub type OverweightIndex = u64;
|
||||
|
||||
const LOG_TARGET: &str = "xcmp_queue";
|
||||
const DEFAULT_POV_SIZE: u64 = 64 * 1024; // 64 KB
|
||||
|
||||
#[frame_support::pallet]
|
||||
pub mod pallet {
|
||||
@@ -134,11 +138,11 @@ pub mod pallet {
|
||||
///
|
||||
/// Events:
|
||||
/// - `OverweightServiced`: On success.
|
||||
#[pallet::weight((weight_limit.saturating_add(Weight::from_ref_time(1_000_000)), DispatchClass::Operational,))]
|
||||
#[pallet::weight((Weight::from_ref_time(weight_limit.saturating_add(1_000_000)), DispatchClass::Operational,))]
|
||||
pub fn service_overweight(
|
||||
origin: OriginFor<T>,
|
||||
index: OverweightIndex,
|
||||
weight_limit: Weight,
|
||||
weight_limit: XcmWeight,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
T::ExecuteOverweightOrigin::ensure_origin(origin)?;
|
||||
|
||||
@@ -149,8 +153,9 @@ pub mod pallet {
|
||||
&mut data.as_slice(),
|
||||
)
|
||||
.map_err(|_| Error::<T>::BadXcm)?;
|
||||
let used = Self::handle_xcm_message(sender, sent_at, xcm, weight_limit)
|
||||
.map_err(|_| Error::<T>::WeightOverLimit)?;
|
||||
let used =
|
||||
Self::handle_xcm_message(sender, sent_at, xcm, Weight::from_ref_time(weight_limit))
|
||||
.map_err(|_| Error::<T>::WeightOverLimit)?;
|
||||
Overweight::<T>::remove(index);
|
||||
Self::deposit_event(Event::OverweightServiced { index, used });
|
||||
Ok(Some(used.saturating_add(Weight::from_ref_time(1_000_000))).into())
|
||||
@@ -226,9 +231,9 @@ pub mod pallet {
|
||||
/// - `origin`: Must pass `Root`.
|
||||
/// - `new`: Desired value for `QueueConfigData.threshold_weight`
|
||||
#[pallet::weight((T::WeightInfo::set_config_with_weight(), DispatchClass::Operational,))]
|
||||
pub fn update_threshold_weight(origin: OriginFor<T>, new: Weight) -> DispatchResult {
|
||||
pub fn update_threshold_weight(origin: OriginFor<T>, new: XcmWeight) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
QueueConfig::<T>::mutate(|data| data.threshold_weight = new);
|
||||
QueueConfig::<T>::mutate(|data| data.threshold_weight = Weight::from_ref_time(new));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -239,9 +244,14 @@ pub mod pallet {
|
||||
/// - `origin`: Must pass `Root`.
|
||||
/// - `new`: Desired value for `QueueConfigData.weight_restrict_decay`.
|
||||
#[pallet::weight((T::WeightInfo::set_config_with_weight(), DispatchClass::Operational,))]
|
||||
pub fn update_weight_restrict_decay(origin: OriginFor<T>, new: Weight) -> DispatchResult {
|
||||
pub fn update_weight_restrict_decay(
|
||||
origin: OriginFor<T>,
|
||||
new: XcmWeight,
|
||||
) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
QueueConfig::<T>::mutate(|data| data.weight_restrict_decay = new);
|
||||
QueueConfig::<T>::mutate(|data| {
|
||||
data.weight_restrict_decay = Weight::from_ref_time(new)
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -254,10 +264,12 @@ pub mod pallet {
|
||||
#[pallet::weight((T::WeightInfo::set_config_with_weight(), DispatchClass::Operational,))]
|
||||
pub fn update_xcmp_max_individual_weight(
|
||||
origin: OriginFor<T>,
|
||||
new: Weight,
|
||||
new: XcmWeight,
|
||||
) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
QueueConfig::<T>::mutate(|data| data.xcmp_max_individual_weight = new);
|
||||
QueueConfig::<T>::mutate(|data| {
|
||||
data.xcmp_max_individual_weight = Weight::from_ref_time(new)
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -455,7 +467,10 @@ impl Default for QueueConfigData {
|
||||
resume_threshold: 1,
|
||||
threshold_weight: Weight::from_ref_time(100_000),
|
||||
weight_restrict_decay: Weight::from_ref_time(2),
|
||||
xcmp_max_individual_weight: 20u64 * WEIGHT_PER_MILLIS,
|
||||
xcmp_max_individual_weight: Weight::from_parts(
|
||||
20u64 * WEIGHT_PER_MILLIS.ref_time(),
|
||||
DEFAULT_POV_SIZE,
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user