Skip to content

Commit

Permalink
Merge pull request availproject#167 from availproject/ghali/remove-un…
Browse files Browse the repository at this point in the history
…used-storage

remove unused storage
  • Loading branch information
Leouarz authored Jun 5, 2023
2 parents 49e2c04 + 18f1905 commit 9604586
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 46 deletions.
23 changes: 0 additions & 23 deletions avail-subxt/src/api_dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16478,29 +16478,6 @@ pub mod api {
)
}

#[doc = " Last block length proposal."]
#[doc = " # TODO"]
#[doc = " - It is not used, could we removed it?"]
pub fn last_block_len_id(
&self,
) -> ::subxt::storage::address::StaticStorageAddress<
::subxt::metadata::DecodeStaticType<::core::primitive::u32>,
::subxt::storage::address::Yes,
::subxt::storage::address::Yes,
(),
> {
::subxt::storage::address::StaticStorageAddress::new(
"DataAvailability",
"LastBlockLenId",
vec![],
[
51u8, 88u8, 3u8, 49u8, 185u8, 211u8, 12u8, 141u8, 53u8, 34u8, 47u8,
67u8, 163u8, 215u8, 249u8, 135u8, 80u8, 9u8, 236u8, 177u8, 219u8, 94u8,
56u8, 168u8, 176u8, 149u8, 104u8, 19u8, 20u8, 189u8, 124u8, 213u8,
],
)
}

#[doc = " Store all application keys."]
pub fn app_keys(
&self,
Expand Down
17 changes: 0 additions & 17 deletions pallets/dactr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ pub mod pallet {
#[pallet::getter(fn peek_next_application_id)]
pub type NextAppId<T: Config> = StorageValue<_, AppId, ValueQuery>;

/// Last block length proposal.
/// # TODO
/// - It is not used, could we removed it?
#[pallet::storage]
#[pallet::getter(fn last_block_length_proposal_id)]
pub type LastBlockLenId<T: Config> = StorageValue<_, T::BlockLenProposalId, ValueQuery>;

/// Store all application keys.
#[pallet::storage]
#[pallet::getter(fn application_key)]
Expand Down Expand Up @@ -165,7 +158,6 @@ pub mod pallet {
BlockLength::with_normal_ratio(rows, cols, BLOCK_CHUNK_SIZE, NORMAL_DISPATCH_RATIO)
.map_err(|_| Error::<T>::BlockDimensionsOutOfBounds)?;

let _id = Self::next_block_len_proposal_id()?;
DynamicBlockLength::<T>::put(block_length);

Self::deposit_event(Event::BlockLengthProposalSubmitted { rows, cols });
Expand Down Expand Up @@ -288,13 +280,4 @@ impl<T: Config> Pallet<T> {
Ok(replace(id, new_id))
})
}

pub fn next_block_len_proposal_id() -> Result<T::BlockLenProposalId, Error<T>> {
LastBlockLenId::<T>::try_mutate(|id| {
let new_id = id
.checked_add(&One::one())
.ok_or(Error::<T>::LastBlockLenProposalIdOverflowed)?;
Ok(replace(id, new_id))
})
}
}
8 changes: 2 additions & 6 deletions pallets/dactr/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Standard Error: 3
.saturating_add(Weight::from_ref_time(1_328_u64).saturating_mul(i as u64))
}
// Storage: DataAvailability LastBlockLenId (r:1 w:1)
// Storage: System DynamicBlockLength (r:0 w:1)
fn submit_block_length_proposal() -> Weight {
// Minimum execution time: 34_500 nanoseconds.
Weight::from_ref_time(35_272_000_u64)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}

Expand All @@ -97,12 +95,10 @@ impl WeightInfo for () {
// Standard Error: 3
.saturating_add(Weight::from_ref_time(1_328_u64).saturating_mul(i as u64))
}
// Storage: DataAvailability LastBlockLenId (r:1 w:1)
// Storage: System DynamicBlockLength (r:0 w:1)
fn submit_block_length_proposal() -> Weight {
// Minimum execution time: 34_500 nanoseconds.
Weight::from_ref_time(35_272_000_u64)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
}

0 comments on commit 9604586

Please sign in to comment.