Skip to content

Commit 51d2e4b

Browse files
gabriele-0201pepyakin
authored andcommitted
kill and take in on_finalize
1 parent 26a8d7a commit 51d2e4b

File tree

1 file changed

+8
-7
lines changed
  • sugondat-chain/pallets/blobs/src

1 file changed

+8
-7
lines changed

sugondat-chain/pallets/blobs/src/lib.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,17 @@ pub mod pallet {
117117
#[pallet::hooks]
118118
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
119119
fn on_initialize(_: BlockNumberFor<T>) -> Weight {
120-
let weight = T::DbWeight::get().reads_writes(1, 0);
121-
TotalBlobsSize::<T>::kill();
122-
TotalBlobs::<T>::kill();
123-
BlobList::<T>::kill();
124-
weight
120+
// BlobList: 1r + 1w
121+
// TotalBlobsSize: 1w
122+
// TotalBlobs: 1w
123+
// deposit_log: 1r + 1w
124+
T::DbWeight::get().reads_writes(2, 4)
125125
}
126126

127127
fn on_finalize(_n: BlockNumberFor<T>) {
128-
let blobs_metadata = BlobList::<T>::get();
129-
let blobs = blobs_metadata
128+
TotalBlobsSize::<T>::kill();
129+
TotalBlobs::<T>::kill();
130+
let blobs = BlobList::<T>::take()
130131
.iter()
131132
.map(|blob| sugondat_nmt::BlobMetadata {
132133
namespace: sugondat_nmt::Namespace::from_u32_be(blob.namespace_id),

0 commit comments

Comments
 (0)