Skip to content

Commit

Permalink
A0-3340: Remove committee change digest (#1443)
Browse files Browse the repository at this point in the history
# Description
Removal of the committee change digest.
  • Loading branch information
krzysztofziobro authored Oct 16, 2023
1 parent 07e2ebf commit 1a00a8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
22 changes: 2 additions & 20 deletions pallets/aleph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ mod traits;

use frame_support::{
log,
sp_runtime::{BoundToRuntimeAppPublic, DigestItem},
sp_runtime::BoundToRuntimeAppPublic,
traits::{OneSessionHandler, StorageVersion},
};
pub use pallet::*;
use primitives::{
ConsensusLog::AlephAuthorityChange, SessionIndex, Version, VersionChange, ALEPH_ENGINE_ID,
DEFAULT_FINALITY_VERSION, LEGACY_FINALITY_VERSION,
SessionIndex, Version, VersionChange, DEFAULT_FINALITY_VERSION, LEGACY_FINALITY_VERSION,
};
use sp_std::prelude::*;

Expand Down Expand Up @@ -113,23 +112,6 @@ pub mod pallet {
pub(super) type FinalityScheduledVersionChange<T: Config> =
StorageValue<_, VersionChange, OptionQuery>;

#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_finalize(block_number: BlockNumberFor<T>) {
if let Some(session_change_block) =
T::SessionInfoProvider::next_session_block_number(block_number)
{
if session_change_block == block_number + 1u32.into() {
<frame_system::Pallet<T>>::deposit_log(DigestItem::Consensus(
ALEPH_ENGINE_ID,
AlephAuthorityChange::<T::AuthorityId>(<NextAuthorities<T>>::get())
.encode(),
));
}
}
}
}

impl<T: Config> Pallet<T> {
pub(crate) fn initialize_authorities(
authorities: &[T::AuthorityId],
Expand Down
9 changes: 0 additions & 9 deletions primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,6 @@ pub struct VersionChange {
pub session: SessionIndex,
}

/// Consensus log item for Aleph.
#[cfg_attr(feature = "std", derive(Serialize))]
#[derive(Decode, Encode, PartialEq, Eq, Clone, sp_runtime::RuntimeDebug)]
pub enum ConsensusLog<N: sp_runtime::RuntimeAppPublic> {
/// Change of the authorities.
#[codec(index = 1)]
AlephAuthorityChange(Vec<N>),
}

sp_api::decl_runtime_apis! {
pub trait AlephSessionApi {
fn next_session_authorities() -> Result<Vec<AuthorityId>, ApiError>;
Expand Down

0 comments on commit 1a00a8f

Please sign in to comment.