Skip to content

Commit

Permalink
account for all parameters on_initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekkMA committed Aug 2, 2024
1 parent 08968b2 commit 5861a10
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions substrate/frame/parameters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ pub mod pallet {
type WeightInfo: WeightInfo;
}

#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_initialize(_: BlockNumberFor<T>) -> Weight {
let items = Parameters::<T>::iter().count() as u64;

Weight::zero().saturating_add(T::DbWeight::get().reads(items))
}
}

#[pallet::event]
#[pallet::generate_deposit(pub(crate) fn deposit_event)]
pub enum Event<T: Config> {
Expand Down

0 comments on commit 5861a10

Please sign in to comment.