mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
Update pallet macro migrations. (#8766)
* Update pallet macro migrations. * Revert dispatchable call visibility changes. * fmt
This commit is contained in:
@@ -401,10 +401,10 @@ pub mod pallet {
|
|||||||
pub fn plan_config_change(
|
pub fn plan_config_change(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
config: NextConfigDescriptor,
|
config: NextConfigDescriptor,
|
||||||
) -> DispatchResultWithPostInfo {
|
) -> DispatchResult {
|
||||||
ensure_root(origin)?;
|
ensure_root(origin)?;
|
||||||
PendingEpochConfigChange::<T>::put(config);
|
PendingEpochConfigChange::<T>::put(config);
|
||||||
Ok(().into())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ pub mod pallet {
|
|||||||
// since signature verification is done in `validate_unsigned`
|
// since signature verification is done in `validate_unsigned`
|
||||||
// we can skip doing it here again.
|
// we can skip doing it here again.
|
||||||
_signature: <T::AuthorityId as RuntimeAppPublic>::Signature,
|
_signature: <T::AuthorityId as RuntimeAppPublic>::Signature,
|
||||||
) -> DispatchResultWithPostInfo {
|
) -> DispatchResult {
|
||||||
ensure_none(origin)?;
|
ensure_none(origin)?;
|
||||||
|
|
||||||
let current_session = T::ValidatorSet::session_index();
|
let current_session = T::ValidatorSet::session_index();
|
||||||
@@ -417,7 +417,7 @@ pub mod pallet {
|
|||||||
&network_state
|
&network_state
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(().into())
|
Ok(())
|
||||||
} else if exists {
|
} else if exists {
|
||||||
Err(Error::<T>::DuplicatedHeartbeat)?
|
Err(Error::<T>::DuplicatedHeartbeat)?
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ fn heartbeat(
|
|||||||
authority_index: u32,
|
authority_index: u32,
|
||||||
id: UintAuthorityId,
|
id: UintAuthorityId,
|
||||||
validators: Vec<u64>,
|
validators: Vec<u64>,
|
||||||
) -> dispatch::DispatchResultWithPostInfo {
|
) -> dispatch::DispatchResult {
|
||||||
use frame_support::unsigned::ValidateUnsigned;
|
use frame_support::unsigned::ValidateUnsigned;
|
||||||
|
|
||||||
let heartbeat = Heartbeat {
|
let heartbeat = Heartbeat {
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ pub mod pallet {
|
|||||||
/// - One event.
|
/// - One event.
|
||||||
/// # </weight>
|
/// # </weight>
|
||||||
#[pallet::weight(50_000_000)]
|
#[pallet::weight(50_000_000)]
|
||||||
pub(super) fn set_name(origin: OriginFor<T>, name: Vec<u8>) -> DispatchResultWithPostInfo {
|
pub(super) fn set_name(origin: OriginFor<T>, name: Vec<u8>) -> DispatchResult {
|
||||||
let sender = ensure_signed(origin)?;
|
let sender = ensure_signed(origin)?;
|
||||||
|
|
||||||
ensure!(name.len() >= T::MinLength::get() as usize, Error::<T>::TooShort);
|
ensure!(name.len() >= T::MinLength::get() as usize, Error::<T>::TooShort);
|
||||||
@@ -158,7 +158,7 @@ pub mod pallet {
|
|||||||
};
|
};
|
||||||
|
|
||||||
<NameOf<T>>::insert(&sender, (name, deposit));
|
<NameOf<T>>::insert(&sender, (name, deposit));
|
||||||
Ok(().into())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear an account's name and return the deposit. Fails if the account was not named.
|
/// Clear an account's name and return the deposit. Fails if the account was not named.
|
||||||
@@ -172,7 +172,7 @@ pub mod pallet {
|
|||||||
/// - One event.
|
/// - One event.
|
||||||
/// # </weight>
|
/// # </weight>
|
||||||
#[pallet::weight(70_000_000)]
|
#[pallet::weight(70_000_000)]
|
||||||
pub(super) fn clear_name(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
|
pub(super) fn clear_name(origin: OriginFor<T>) -> DispatchResult {
|
||||||
let sender = ensure_signed(origin)?;
|
let sender = ensure_signed(origin)?;
|
||||||
|
|
||||||
let deposit = <NameOf<T>>::take(&sender).ok_or(Error::<T>::Unnamed)?.1;
|
let deposit = <NameOf<T>>::take(&sender).ok_or(Error::<T>::Unnamed)?.1;
|
||||||
@@ -181,7 +181,7 @@ pub mod pallet {
|
|||||||
debug_assert!(err_amount.is_zero());
|
debug_assert!(err_amount.is_zero());
|
||||||
|
|
||||||
Self::deposit_event(Event::<T>::NameCleared(sender, deposit));
|
Self::deposit_event(Event::<T>::NameCleared(sender, deposit));
|
||||||
Ok(().into())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove an account's name and take charge of the deposit.
|
/// Remove an account's name and take charge of the deposit.
|
||||||
@@ -201,7 +201,7 @@ pub mod pallet {
|
|||||||
pub(super) fn kill_name(
|
pub(super) fn kill_name(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
target: <T::Lookup as StaticLookup>::Source
|
target: <T::Lookup as StaticLookup>::Source
|
||||||
) -> DispatchResultWithPostInfo {
|
) -> DispatchResult {
|
||||||
T::ForceOrigin::ensure_origin(origin)?;
|
T::ForceOrigin::ensure_origin(origin)?;
|
||||||
|
|
||||||
// Figure out who we're meant to be clearing.
|
// Figure out who we're meant to be clearing.
|
||||||
@@ -212,7 +212,7 @@ pub mod pallet {
|
|||||||
T::Slashed::on_unbalanced(T::Currency::slash_reserved(&target, deposit.clone()).0);
|
T::Slashed::on_unbalanced(T::Currency::slash_reserved(&target, deposit.clone()).0);
|
||||||
|
|
||||||
Self::deposit_event(Event::<T>::NameKilled(target, deposit));
|
Self::deposit_event(Event::<T>::NameKilled(target, deposit));
|
||||||
Ok(().into())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set a third-party account's name with no deposit.
|
/// Set a third-party account's name with no deposit.
|
||||||
@@ -232,7 +232,7 @@ pub mod pallet {
|
|||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
target: <T::Lookup as StaticLookup>::Source,
|
target: <T::Lookup as StaticLookup>::Source,
|
||||||
name: Vec<u8>
|
name: Vec<u8>
|
||||||
) -> DispatchResultWithPostInfo {
|
) -> DispatchResult {
|
||||||
T::ForceOrigin::ensure_origin(origin)?;
|
T::ForceOrigin::ensure_origin(origin)?;
|
||||||
|
|
||||||
let target = T::Lookup::lookup(target)?;
|
let target = T::Lookup::lookup(target)?;
|
||||||
@@ -240,7 +240,7 @@ pub mod pallet {
|
|||||||
<NameOf<T>>::insert(&target, (name, deposit));
|
<NameOf<T>>::insert(&target, (name, deposit));
|
||||||
|
|
||||||
Self::deposit_event(Event::<T>::NameForced(target));
|
Self::deposit_event(Event::<T>::NameForced(target));
|
||||||
Ok(().into())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ pub mod pallet {
|
|||||||
T::WeightInfo::set(),
|
T::WeightInfo::set(),
|
||||||
DispatchClass::Mandatory
|
DispatchClass::Mandatory
|
||||||
))]
|
))]
|
||||||
pub(super) fn set(origin: OriginFor<T>, #[pallet::compact] now: T::Moment) -> DispatchResultWithPostInfo {
|
pub(super) fn set(origin: OriginFor<T>, #[pallet::compact] now: T::Moment) -> DispatchResult {
|
||||||
ensure_none(origin)?;
|
ensure_none(origin)?;
|
||||||
assert!(!DidUpdate::<T>::exists(), "Timestamp must be updated only once in the block");
|
assert!(!DidUpdate::<T>::exists(), "Timestamp must be updated only once in the block");
|
||||||
let prev = Self::now();
|
let prev = Self::now();
|
||||||
@@ -196,7 +196,7 @@ pub mod pallet {
|
|||||||
|
|
||||||
<T::OnTimestampSet as OnTimestampSet<_>>::on_timestamp_set(now);
|
<T::OnTimestampSet as OnTimestampSet<_>>::on_timestamp_set(now);
|
||||||
|
|
||||||
Ok(().into())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user