Update pallet macro migrations. (#8766)

* Update pallet macro migrations.

* Revert dispatchable call visibility changes.

* fmt
This commit is contained in:
Shaun Wang
2021-05-11 01:55:25 +12:00
committed by GitHub
parent f16f8def08
commit 9ae9267e9a
5 changed files with 15 additions and 15 deletions
+2 -2
View File
@@ -401,10 +401,10 @@ pub mod pallet {
pub fn plan_config_change(
origin: OriginFor<T>,
config: NextConfigDescriptor,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
ensure_root(origin)?;
PendingEpochConfigChange::<T>::put(config);
Ok(().into())
Ok(())
}
}
}
+2 -2
View File
@@ -397,7 +397,7 @@ pub mod pallet {
// since signature verification is done in `validate_unsigned`
// we can skip doing it here again.
_signature: <T::AuthorityId as RuntimeAppPublic>::Signature,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
ensure_none(origin)?;
let current_session = T::ValidatorSet::session_index();
@@ -417,7 +417,7 @@ pub mod pallet {
&network_state
);
Ok(().into())
Ok(())
} else if exists {
Err(Error::<T>::DuplicatedHeartbeat)?
} else {
+1 -1
View File
@@ -114,7 +114,7 @@ fn heartbeat(
authority_index: u32,
id: UintAuthorityId,
validators: Vec<u64>,
) -> dispatch::DispatchResultWithPostInfo {
) -> dispatch::DispatchResult {
use frame_support::unsigned::ValidateUnsigned;
let heartbeat = Heartbeat {
+8 -8
View File
@@ -141,7 +141,7 @@ pub mod pallet {
/// - One event.
/// # </weight>
#[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)?;
ensure!(name.len() >= T::MinLength::get() as usize, Error::<T>::TooShort);
@@ -158,7 +158,7 @@ pub mod pallet {
};
<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.
@@ -172,7 +172,7 @@ pub mod pallet {
/// - One event.
/// # </weight>
#[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 deposit = <NameOf<T>>::take(&sender).ok_or(Error::<T>::Unnamed)?.1;
@@ -181,7 +181,7 @@ pub mod pallet {
debug_assert!(err_amount.is_zero());
Self::deposit_event(Event::<T>::NameCleared(sender, deposit));
Ok(().into())
Ok(())
}
/// Remove an account's name and take charge of the deposit.
@@ -201,7 +201,7 @@ pub mod pallet {
pub(super) fn kill_name(
origin: OriginFor<T>,
target: <T::Lookup as StaticLookup>::Source
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
T::ForceOrigin::ensure_origin(origin)?;
// 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);
Self::deposit_event(Event::<T>::NameKilled(target, deposit));
Ok(().into())
Ok(())
}
/// Set a third-party account's name with no deposit.
@@ -232,7 +232,7 @@ pub mod pallet {
origin: OriginFor<T>,
target: <T::Lookup as StaticLookup>::Source,
name: Vec<u8>
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
T::ForceOrigin::ensure_origin(origin)?;
let target = T::Lookup::lookup(target)?;
@@ -240,7 +240,7 @@ pub mod pallet {
<NameOf<T>>::insert(&target, (name, deposit));
Self::deposit_event(Event::<T>::NameForced(target));
Ok(().into())
Ok(())
}
}
}
+2 -2
View File
@@ -183,7 +183,7 @@ pub mod pallet {
T::WeightInfo::set(),
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)?;
assert!(!DidUpdate::<T>::exists(), "Timestamp must be updated only once in the block");
let prev = Self::now();
@@ -196,7 +196,7 @@ pub mod pallet {
<T::OnTimestampSet as OnTimestampSet<_>>::on_timestamp_set(now);
Ok(().into())
Ok(())
}
}