Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Update pallet macro migrations. #8766

Merged
merged 3 commits into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frame/babe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions frame/im-online/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -417,7 +417,7 @@ pub mod pallet {
&network_state
);

Ok(().into())
Ok(())
} else if exists {
Err(Error::<T>::DuplicatedHeartbeat)?
} else {
Expand Down
2 changes: 1 addition & 1 deletion frame/im-online/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions frame/nicks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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.
Expand All @@ -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;
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -232,15 +232,15 @@ 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)?;
let deposit = <NameOf<T>>::get(&target).map(|x| x.1).unwrap_or_else(Zero::zero);
<NameOf<T>>::insert(&target, (name, deposit));

Self::deposit_event(Event::<T>::NameForced(target));
Ok(().into())
Ok(())
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions frame/timestamp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -196,7 +196,7 @@ pub mod pallet {

<T::OnTimestampSet as OnTimestampSet<_>>::on_timestamp_set(now);

Ok(().into())
Ok(())
}
}

Expand Down