mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 22:41:06 +00:00
Ignore empty authority changes (#13010)
When something tries to enact an authority change with an empty authority set, we will ignore this now.
This commit is contained in:
@@ -153,7 +153,15 @@ impl<T: Config> Pallet<T> {
|
|||||||
///
|
///
|
||||||
/// The storage will be applied immediately.
|
/// The storage will be applied immediately.
|
||||||
/// And aura consensus log will be appended to block's log.
|
/// And aura consensus log will be appended to block's log.
|
||||||
|
///
|
||||||
|
/// This is a no-op if `new` is empty.
|
||||||
pub fn change_authorities(new: BoundedVec<T::AuthorityId, T::MaxAuthorities>) {
|
pub fn change_authorities(new: BoundedVec<T::AuthorityId, T::MaxAuthorities>) {
|
||||||
|
if new.is_empty() {
|
||||||
|
log::warn!(target: LOG_TARGET, "Ignoring empty authority change.");
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
<Authorities<T>>::put(&new);
|
<Authorities<T>>::put(&new);
|
||||||
|
|
||||||
let log = DigestItem::Consensus(
|
let log = DigestItem::Consensus(
|
||||||
|
|||||||
@@ -572,6 +572,8 @@ impl<T: Config> Pallet<T> {
|
|||||||
///
|
///
|
||||||
/// Typically, this is not handled directly by the user, but by higher-level validator-set
|
/// Typically, this is not handled directly by the user, but by higher-level validator-set
|
||||||
/// manager logic like `pallet-session`.
|
/// manager logic like `pallet-session`.
|
||||||
|
///
|
||||||
|
/// This doesn't do anything if `authorities` is empty.
|
||||||
pub fn enact_epoch_change(
|
pub fn enact_epoch_change(
|
||||||
authorities: WeakBoundedVec<(AuthorityId, BabeAuthorityWeight), T::MaxAuthorities>,
|
authorities: WeakBoundedVec<(AuthorityId, BabeAuthorityWeight), T::MaxAuthorities>,
|
||||||
next_authorities: WeakBoundedVec<(AuthorityId, BabeAuthorityWeight), T::MaxAuthorities>,
|
next_authorities: WeakBoundedVec<(AuthorityId, BabeAuthorityWeight), T::MaxAuthorities>,
|
||||||
@@ -580,6 +582,12 @@ impl<T: Config> Pallet<T> {
|
|||||||
// by the session module to be called before this.
|
// by the session module to be called before this.
|
||||||
debug_assert!(Self::initialized().is_some());
|
debug_assert!(Self::initialized().is_some());
|
||||||
|
|
||||||
|
if authorities.is_empty() {
|
||||||
|
log::warn!(target: LOG_TARGET, "Ignoring empty epoch change.");
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Update epoch index
|
// Update epoch index
|
||||||
let epoch_index = EpochIndex::<T>::get()
|
let epoch_index = EpochIndex::<T>::get()
|
||||||
.checked_add(1)
|
.checked_add(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user