mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 19:51:05 +00:00
Add Storage Info to Various Pallets (#10810)
* atomic swap * bounties * bounties fmt * gilt * indices * nicks * randomness-collective-flip * recovery * reuse maxapprovals * Update tests.rs * Update frame/randomness-collective-flip/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * use the correct bound * complete recovery * use `bounded_vec` macro * Update tests.rs * transaction payment * uniques * mmr * example offchain worker * beefy-mmr * Update frame/recovery/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Use BoundedVec instead of a type-parameterized BoundedString * cargo fmt * Update frame/atomic-swap/src/lib.rs * use config const * Update lib.rs * update mel_bound * fmt Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
@@ -91,7 +91,6 @@ pub mod pallet {
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::generate_store(pub(super) trait Store)]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
@@ -103,9 +102,7 @@ pub mod pallet {
|
||||
let parent_hash = <frame_system::Pallet<T>>::parent_hash();
|
||||
|
||||
<RandomMaterial<T>>::mutate(|ref mut values| {
|
||||
if values.len() < RANDOM_MATERIAL_LEN as usize {
|
||||
values.push(parent_hash)
|
||||
} else {
|
||||
if values.try_push(parent_hash).is_err() {
|
||||
let index = block_number_to_index::<T>(block_number);
|
||||
values[index] = parent_hash;
|
||||
}
|
||||
@@ -120,7 +117,8 @@ pub mod pallet {
|
||||
/// the oldest hash.
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn random_material)]
|
||||
pub(super) type RandomMaterial<T: Config> = StorageValue<_, Vec<T::Hash>, ValueQuery>;
|
||||
pub(super) type RandomMaterial<T: Config> =
|
||||
StorageValue<_, BoundedVec<T::Hash, ConstU32<RANDOM_MATERIAL_LEN>>, ValueQuery>;
|
||||
}
|
||||
|
||||
impl<T: Config> Randomness<T::Hash, T::BlockNumber> for Pallet<T> {
|
||||
|
||||
Reference in New Issue
Block a user