mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-17 15:55:42 +00:00
BREAKING: Rename Call & Event (#11981)
* rename Event to RuntimeEvent * rename Call * rename in runtimes * small fix * rename Event * small fix & rename RuntimeCall back to Call for now * small fixes * more renaming * a bit more renaming * fmt * small fix * commit * prep for renaming associated types * fix * rename associated Event type * rename to RuntimeEvent * commit * merge conflict fixes & fmt * additional renaming * fix. * fix decl_event * rename in tests * remove warnings * remove accidental rename * . * commit * update .stderr * fix in test * update .stderr * TRYBUILD=overwrite * docs * fmt * small change in docs * rename PalletEvent to Event * rename Call to RuntimeCall * renamed at wrong places :P * rename Call * rename * rename associated type * fix * fix & fmt * commit * frame-support-test * passing tests * update docs * rustdoc fix * update .stderr * wrong code in docs * merge fix * fix in error message * update .stderr * docs & error message * . * merge fix * merge fix * fmt * fmt * merge fix * more fixing * fmt * remove unused * fmt * fix Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -205,7 +205,7 @@ pub mod pallet {
|
||||
pub trait Config: 'static + Eq + Clone {
|
||||
/// The basic call filter to use in Origin. All origins are built with this filter as base,
|
||||
/// except Root.
|
||||
type BaseCallFilter: Contains<Self::Call>;
|
||||
type BaseCallFilter: Contains<Self::RuntimeCall>;
|
||||
|
||||
/// Block & extrinsics weights: base values and limits.
|
||||
#[pallet::constant]
|
||||
@@ -219,10 +219,10 @@ pub mod pallet {
|
||||
type Origin: Into<Result<RawOrigin<Self::AccountId>, Self::Origin>>
|
||||
+ From<RawOrigin<Self::AccountId>>
|
||||
+ Clone
|
||||
+ OriginTrait<Call = Self::Call>;
|
||||
+ OriginTrait<Call = Self::RuntimeCall>;
|
||||
|
||||
/// The aggregated `Call` type.
|
||||
type Call: Dispatchable + Debug;
|
||||
/// The aggregated `RuntimeCall` type.
|
||||
type RuntimeCall: Dispatchable + Debug;
|
||||
|
||||
/// Account index (aka nonce) type. This stores the number of previous transactions
|
||||
/// associated with a sender account.
|
||||
@@ -293,11 +293,11 @@ pub mod pallet {
|
||||
type Header: Parameter + traits::Header<Number = Self::BlockNumber, Hash = Self::Hash>;
|
||||
|
||||
/// The aggregated event type of the runtime.
|
||||
type Event: Parameter
|
||||
type RuntimeEvent: Parameter
|
||||
+ Member
|
||||
+ From<Event<Self>>
|
||||
+ Debug
|
||||
+ IsType<<Self as frame_system::Config>::Event>;
|
||||
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
|
||||
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
|
||||
#[pallet::constant]
|
||||
@@ -608,7 +608,7 @@ pub mod pallet {
|
||||
#[pallet::storage]
|
||||
#[pallet::unbounded]
|
||||
pub(super) type Events<T: Config> =
|
||||
StorageValue<_, Vec<Box<EventRecord<T::Event, T::Hash>>>, ValueQuery>;
|
||||
StorageValue<_, Vec<Box<EventRecord<T::RuntimeEvent, T::Hash>>>, ValueQuery>;
|
||||
|
||||
/// The number of events in the `Events<T>` list.
|
||||
#[pallet::storage]
|
||||
@@ -1216,7 +1216,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
|
||||
/// Deposits an event into this block's event record.
|
||||
pub fn deposit_event(event: impl Into<T::Event>) {
|
||||
pub fn deposit_event(event: impl Into<T::RuntimeEvent>) {
|
||||
Self::deposit_event_indexed(&[], event.into());
|
||||
}
|
||||
|
||||
@@ -1225,7 +1225,7 @@ impl<T: Config> Pallet<T> {
|
||||
///
|
||||
/// This will update storage entries that correspond to the specified topics.
|
||||
/// It is expected that light-clients could subscribe to this topics.
|
||||
pub fn deposit_event_indexed(topics: &[T::Hash], event: T::Event) {
|
||||
pub fn deposit_event_indexed(topics: &[T::Hash], event: T::RuntimeEvent) {
|
||||
let block_number = Self::block_number();
|
||||
// Don't populate events on genesis.
|
||||
if block_number.is_zero() {
|
||||
@@ -1415,7 +1415,7 @@ impl<T: Config> Pallet<T> {
|
||||
/// 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>> {
|
||||
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()
|
||||
@@ -1425,7 +1425,7 @@ impl<T: Config> Pallet<T> {
|
||||
///
|
||||
/// 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::Event, T::Hash>>> {
|
||||
pub fn read_events_no_consensus() -> Vec<Box<EventRecord<T::RuntimeEvent, T::Hash>>> {
|
||||
Events::<T>::get()
|
||||
}
|
||||
|
||||
@@ -1470,13 +1470,13 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
/// Assert the given `event` exists.
|
||||
#[cfg(any(feature = "std", feature = "runtime-benchmarks", test))]
|
||||
pub fn assert_has_event(event: T::Event) {
|
||||
pub fn assert_has_event(event: T::RuntimeEvent) {
|
||||
assert!(Self::events().iter().any(|record| record.event == event))
|
||||
}
|
||||
|
||||
/// Assert the last event equal to the given `event`.
|
||||
#[cfg(any(feature = "std", feature = "runtime-benchmarks", test))]
|
||||
pub fn assert_last_event(event: T::Event) {
|
||||
pub fn assert_last_event(event: T::RuntimeEvent) {
|
||||
assert_eq!(Self::events().last().expect("events expected").event, event);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user