mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 15:11:03 +00:00
Merge branch 'master' into gav-xcm-v3
This commit is contained in:
+12
-12
@@ -48,9 +48,9 @@ pub mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config {
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
|
||||
type XcmExecutor: ExecuteXcm<Self::Call>;
|
||||
type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
@@ -111,20 +111,20 @@ impl<T: Config> DmpMessageHandler for UnlimitedDmpExecution<T> {
|
||||
iter: impl Iterator<Item = (RelayBlockNumber, Vec<u8>)>,
|
||||
limit: Weight,
|
||||
) -> Weight {
|
||||
let mut used = 0;
|
||||
let mut used = Weight::zero();
|
||||
for (_sent_at, data) in iter {
|
||||
let id = sp_io::hashing::blake2_256(&data[..]);
|
||||
let msg = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
|
||||
let msg = VersionedXcm::<T::RuntimeCall>::decode_all_with_depth_limit(
|
||||
MAX_XCM_DECODE_DEPTH,
|
||||
&mut data.as_slice(),
|
||||
)
|
||||
.map(Xcm::<T::Call>::try_from);
|
||||
.map(Xcm::<T::RuntimeCall>::try_from);
|
||||
match msg {
|
||||
Err(_) => Pallet::<T>::deposit_event(Event::InvalidFormat(id)),
|
||||
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
|
||||
Ok(Ok(x)) => {
|
||||
let outcome = T::XcmExecutor::execute_xcm(Parent, x, id, limit);
|
||||
used += outcome.weight_used();
|
||||
let outcome = T::XcmExecutor::execute_xcm(Parent, x, id, limit.ref_time());
|
||||
used += Weight::from_ref_time(outcome.weight_used());
|
||||
Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome));
|
||||
},
|
||||
}
|
||||
@@ -144,21 +144,21 @@ impl<T: Config> DmpMessageHandler for LimitAndDropDmpExecution<T> {
|
||||
iter: impl Iterator<Item = (RelayBlockNumber, Vec<u8>)>,
|
||||
limit: Weight,
|
||||
) -> Weight {
|
||||
let mut used = 0;
|
||||
let mut used = Weight::zero();
|
||||
for (_sent_at, data) in iter {
|
||||
let id = sp_io::hashing::blake2_256(&data[..]);
|
||||
let msg = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
|
||||
let msg = VersionedXcm::<T::RuntimeCall>::decode_all_with_depth_limit(
|
||||
MAX_XCM_DECODE_DEPTH,
|
||||
&mut data.as_slice(),
|
||||
)
|
||||
.map(Xcm::<T::Call>::try_from);
|
||||
.map(Xcm::<T::RuntimeCall>::try_from);
|
||||
match msg {
|
||||
Err(_) => Pallet::<T>::deposit_event(Event::InvalidFormat(id)),
|
||||
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
|
||||
Ok(Ok(x)) => {
|
||||
let weight_limit = limit.saturating_sub(used);
|
||||
let outcome = T::XcmExecutor::execute_xcm(Parent, x, id, weight_limit);
|
||||
used += outcome.weight_used();
|
||||
let outcome = T::XcmExecutor::execute_xcm(Parent, x, id, weight_limit.ref_time());
|
||||
used += Weight::from_ref_time(outcome.weight_used());
|
||||
Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome));
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user