mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 21:17:56 +00:00
Make System Events Private from the Runtime (#9619)
* make events private * "i know what i am doing" * feedback
This commit is contained in:
@@ -612,9 +612,12 @@ pub mod pallet {
|
||||
pub(super) type Digest<T: Config> = StorageValue<_, DigestOf<T>, ValueQuery>;
|
||||
|
||||
/// Events deposited for the current block.
|
||||
///
|
||||
/// NOTE: This storage item is explicitly unbounded since it is never intended to be read
|
||||
/// from within the runtime.
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn events)]
|
||||
pub type Events<T: Config> = StorageValue<_, Vec<EventRecord<T::Event, T::Hash>>, ValueQuery>;
|
||||
pub(super) type Events<T: Config> =
|
||||
StorageValue<_, Vec<EventRecord<T::Event, T::Hash>>, ValueQuery>;
|
||||
|
||||
/// The number of events in the `Events<T>` list.
|
||||
#[pallet::storage]
|
||||
@@ -1448,6 +1451,24 @@ impl<T: Config> Pallet<T> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the current events deposited by the runtime.
|
||||
///
|
||||
/// NOTE: This should only be used in tests. Reading events from the runtime can have a large
|
||||
/// impact on the PoV size of a block. Users should use alternative and well bounded storage
|
||||
/// items for any behavior like this.
|
||||
#[cfg(any(feature = "std", feature = "runtime-benchmarks", test))]
|
||||
pub fn events() -> Vec<EventRecord<T::Event, T::Hash>> {
|
||||
Self::read_events_no_consensus()
|
||||
}
|
||||
|
||||
/// 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<EventRecord<T::Event, T::Hash>> {
|
||||
Events::<T>::get()
|
||||
}
|
||||
|
||||
/// Set the block number to something in particular. Can be used as an alternative to
|
||||
/// `initialize` for tests that don't need to bother with the other environment entries.
|
||||
#[cfg(any(feature = "std", feature = "runtime-benchmarks", test))]
|
||||
|
||||
Reference in New Issue
Block a user