mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
frame_support::storage: Add StorageStreamIter (#12721)
* Save * Add some test * Yep * Move to its own file * More work * More * Finish implementation * Start resolving comments and fixing bugs * Fix all review comments * Update frame/support/src/storage/stream_iter.rs Co-authored-by: Koute <koute@users.noreply.github.com> * Update frame/support/src/storage/stream_iter.rs Co-authored-by: Koute <koute@users.noreply.github.com> * Review feedback * FMT * Okay, let's initialize the values... * Fix... Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
@@ -88,7 +88,7 @@ use frame_support::{
|
||||
extract_actual_pays_fee, extract_actual_weight, DispatchClass, DispatchInfo,
|
||||
DispatchResult, DispatchResultWithPostInfo, PerDispatchClass,
|
||||
},
|
||||
storage,
|
||||
storage::{self, StorageStreamIter},
|
||||
traits::{
|
||||
ConstU32, Contains, EnsureOrigin, Get, HandleLifetime, OnKilledAccount, OnNewAccount,
|
||||
OriginTrait, PalletInfo, SortedMembers, StoredMap, TypedGet,
|
||||
@@ -1444,15 +1444,16 @@ impl<T: Config> Pallet<T> {
|
||||
pub fn events() -> Vec<EventRecord<T::RuntimeEvent, T::Hash>> {
|
||||
// Dereferencing the events here is fine since we are not in the
|
||||
// memory-restricted runtime.
|
||||
Self::read_events_no_consensus().into_iter().map(|e| *e).collect()
|
||||
Self::read_events_no_consensus().map(|e| *e).collect()
|
||||
}
|
||||
|
||||
/// Get the current events deposited by the runtime.
|
||||
///
|
||||
/// Should only be called if you know what you are doing and outside of the runtime block
|
||||
/// execution else it can have a large impact on the PoV size of a block.
|
||||
pub fn read_events_no_consensus() -> Vec<Box<EventRecord<T::RuntimeEvent, T::Hash>>> {
|
||||
Events::<T>::get()
|
||||
pub fn read_events_no_consensus(
|
||||
) -> impl sp_std::iter::Iterator<Item = Box<EventRecord<T::RuntimeEvent, T::Hash>>> {
|
||||
Events::<T>::stream_iter()
|
||||
}
|
||||
|
||||
/// Set the block number to something in particular. Can be used as an alternative to
|
||||
|
||||
Reference in New Issue
Block a user