mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 00:31:07 +00:00
Remove Default bound for AccountId (#10403)
* Remove Default for AccountId * More removals of default * Update frame/authorship/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update frame/authorship/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update frame/authorship/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update frame/authorship/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * More work * More work * Remove old code * More work * pallet-asset-tx-payment * tips * sc-consensus-babe * sc-finality-grandpa * sc-consensus-babe-rpc * sc-cli * make npos crates accept non-default account (#10420) * minimal changes to make npos pallets all work * make this pesky reduce.rs a bit cleaner * more work * more work * Tests build * Fix imonline tests * Formatting * Fixes * Fixes * Fix bench * Fixes * Fixes * Fixes * Fixes * Fixes * Formatting * Fixes * Formatting * Fixes * Formatting * Fixes * Formatting * Fixes * Formatting * Update client/keystore/src/local.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/finality-grandpa/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/keystore/src/local.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/keystore/src/local.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update frame/staking/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update frame/staking/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update primitives/runtime/src/traits.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Formatting Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: kianenigma <kian@parity.io>
This commit is contained in:
@@ -170,7 +170,9 @@ pub mod pallet {
|
||||
|
||||
<DidSetUncles<T>>::put(false);
|
||||
|
||||
T::EventHandler::note_author(Self::author());
|
||||
if let Some(author) = Self::author() {
|
||||
T::EventHandler::note_author(author);
|
||||
}
|
||||
|
||||
0
|
||||
}
|
||||
@@ -300,20 +302,18 @@ impl<T: Config> Pallet<T> {
|
||||
///
|
||||
/// This is safe to invoke in `on_initialize` implementations, as well
|
||||
/// as afterwards.
|
||||
pub fn author() -> T::AccountId {
|
||||
pub fn author() -> Option<T::AccountId> {
|
||||
// Check the memoized storage value.
|
||||
if let Some(author) = <Author<T>>::get() {
|
||||
return author
|
||||
return Some(author)
|
||||
}
|
||||
|
||||
let digest = <frame_system::Pallet<T>>::digest();
|
||||
let pre_runtime_digests = digest.logs.iter().filter_map(|d| d.as_pre_runtime());
|
||||
if let Some(author) = T::FindAuthor::find_author(pre_runtime_digests) {
|
||||
<Author<T>>::put(&author);
|
||||
author
|
||||
} else {
|
||||
Default::default()
|
||||
}
|
||||
T::FindAuthor::find_author(pre_runtime_digests).map(|a| {
|
||||
<Author<T>>::put(&a);
|
||||
a
|
||||
})
|
||||
}
|
||||
|
||||
fn verify_and_import_uncles(new_uncles: Vec<T::Header>) -> dispatch::DispatchResult {
|
||||
@@ -329,14 +329,13 @@ impl<T: Config> Pallet<T> {
|
||||
UncleEntryItem::InclusionHeight(_) => None,
|
||||
UncleEntryItem::Uncle(h, _) => Some(h),
|
||||
});
|
||||
let author = Self::verify_uncle(&uncle, prev_uncles, &mut acc)?;
|
||||
let maybe_author = Self::verify_uncle(&uncle, prev_uncles, &mut acc)?;
|
||||
let hash = uncle.hash();
|
||||
|
||||
T::EventHandler::note_uncle(
|
||||
author.clone().unwrap_or_default(),
|
||||
now - uncle.number().clone(),
|
||||
);
|
||||
uncles.push(UncleEntryItem::Uncle(hash, author));
|
||||
if let Some(author) = maybe_author.clone() {
|
||||
T::EventHandler::note_uncle(author, now - uncle.number().clone());
|
||||
}
|
||||
uncles.push(UncleEntryItem::Uncle(hash, maybe_author));
|
||||
}
|
||||
|
||||
<Uncles<T>>::put(&uncles);
|
||||
@@ -693,7 +692,7 @@ mod tests {
|
||||
header.digest_mut().pop(); // pop the seal off.
|
||||
System::initialize(&1, &Default::default(), header.digest(), Default::default());
|
||||
|
||||
assert_eq!(Authorship::author(), author);
|
||||
assert_eq!(Authorship::author(), Some(author));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user