Skip to content

Commit

Permalink
fix(validator-set): update SessionBlockManager and Heartbeat types to…
Browse files Browse the repository at this point in the history
… use BlockNumberFor for consistency
  • Loading branch information
deblanco committed Dec 18, 2024
1 parent df816b7 commit 860c4d3
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions pallets/validator-set/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub mod pallet {
/// auto removal.
type MinAuthorities: Get<u32>;

type SessionBlockManager: SessionBlockManager<Self::BlockNumber>;
type SessionBlockManager: SessionBlockManager<BlockNumberFor<Self>>;

type FindAuthor: FindAuthor<Self::AccountId>;

Expand Down Expand Up @@ -266,25 +266,25 @@ pub mod pallet {
}
}

#[cfg(feature = "std")]
impl<T: Config> GenesisConfig<T> {
/// Direct implementation of `GenesisBuild::build_storage`.
///
/// Kept in order not to break dependency.
pub fn build_storage(&self) -> Result<sp_runtime::Storage, String> {
<Self as GenesisBuild<T>>::build_storage(self)
}

/// Direct implementation of `GenesisBuild::assimilate_storage`.
///
/// Kept in order not to break dependency.
pub fn assimilate_storage(&self, storage: &mut sp_runtime::Storage) -> Result<(), String> {
<Self as GenesisBuild<T>>::assimilate_storage(self, storage)
}
}
// #[cfg(feature = "std")]
// impl<T: Config> GenesisConfig<T> {
// /// Direct implementation of `GenesisBuild::build_storage`.
// ///
// /// Kept in order not to break dependency.
// pub fn build_storage(&self) -> Result<sp_runtime::Storage, String> {
// <Self as GenesisBuild<T>>::build_storage(self)
// }

// /// Direct implementation of `GenesisBuild::assimilate_storage`.
// ///
// /// Kept in order not to break dependency.
// pub fn assimilate_storage(&self, storage: &mut sp_runtime::Storage) -> Result<(), String> {
// <Self as GenesisBuild<T>>::assimilate_storage(self, storage)
// }
// }

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) {
Pallet::<T>::initialize_validators(self.initial_validators.clone());
MaxMissedEpochs::<T>::put(self.max_epochs_missed.clone());
Expand Down Expand Up @@ -323,7 +323,7 @@ pub mod pallet {
}

fn ensure_unsigned_origin(
heartbeat: Heartbeat<T::BlockNumber, T::AuthorityId>,
heartbeat: Heartbeat<BlockNumberFor<T>, T::AuthorityId>,
signature: <T::AuthorityId as RuntimeAppPublic>::Signature,
) -> Result<(), ()> {
let is_valid = heartbeat
Expand Down

0 comments on commit 860c4d3

Please sign in to comment.