From ba96e8a8f443e313ef9e9a9d73ed9566c0fa1fcc Mon Sep 17 00:00:00 2001 From: yjh Date: Thu, 2 Jun 2022 17:03:49 +0800 Subject: [PATCH] aura: export change_authorities and initialize_authorities (#11468) * aura: export change_authorities and initialize_authorities * add docs * fix docs --- substrate/frame/aura/src/lib.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/substrate/frame/aura/src/lib.rs b/substrate/frame/aura/src/lib.rs index 222360dc3a..fd6882ca9f 100644 --- a/substrate/frame/aura/src/lib.rs +++ b/substrate/frame/aura/src/lib.rs @@ -146,7 +146,11 @@ pub mod pallet { } impl Pallet { - fn change_authorities(new: WeakBoundedVec) { + /// Change authorities. + /// + /// The storage will be applied immediately. + /// And aura consensus log will be appended to block's log. + pub fn change_authorities(new: WeakBoundedVec) { >::put(&new); let log = DigestItem::Consensus( @@ -156,7 +160,12 @@ impl Pallet { >::deposit_log(log); } - fn initialize_authorities(authorities: &[T::AuthorityId]) { + /// Initial authorities. + /// + /// The storage will be applied immediately. + /// + /// The authorities length must be equal or less than T::MaxAuthorities. + pub fn initialize_authorities(authorities: &[T::AuthorityId]) { if !authorities.is_empty() { assert!(>::get().is_empty(), "Authorities are already initialized!"); let bounded = >::try_from(authorities)