mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 22:47:56 +00:00
emit event on remark (#8120)
Co-authored-by: Parity Benchmarking Bot <admin@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -292,8 +292,6 @@ pub mod pallet {
|
||||
///
|
||||
/// # <weight>
|
||||
/// - `O(1)`
|
||||
/// - Base Weight: 0.665 µs, independent of remark length.
|
||||
/// - No DB operations.
|
||||
/// # </weight>
|
||||
#[pallet::weight(T::SystemWeightInfo::remark(_remark.len() as u32))]
|
||||
pub(crate) fn remark(origin: OriginFor<T>, _remark: Vec<u8>) -> DispatchResultWithPostInfo {
|
||||
@@ -450,11 +448,25 @@ pub mod pallet {
|
||||
storage::unhashed::kill_prefix(&prefix);
|
||||
Ok(().into())
|
||||
}
|
||||
|
||||
/// Make some on-chain remark and emit event.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - `O(b)` where b is the length of the remark.
|
||||
/// - 1 event.
|
||||
/// # </weight>
|
||||
#[pallet::weight(T::SystemWeightInfo::remark_with_event(remark.len() as u32))]
|
||||
pub(crate) fn remark_with_event(origin: OriginFor<T>, remark: Vec<u8>) -> DispatchResultWithPostInfo {
|
||||
let who = ensure_signed(origin)?;
|
||||
let hash = T::Hashing::hash(&remark[..]);
|
||||
Self::deposit_event(Event::Remarked(who, hash));
|
||||
Ok(().into())
|
||||
}
|
||||
}
|
||||
|
||||
/// Event for the System pallet.
|
||||
#[pallet::event]
|
||||
#[pallet::metadata(T::AccountId = "AccountId")]
|
||||
#[pallet::metadata(T::AccountId = "AccountId", T::Hash = "Hash")]
|
||||
pub enum Event<T: Config> {
|
||||
/// An extrinsic completed successfully. \[info\]
|
||||
ExtrinsicSuccess(DispatchInfo),
|
||||
@@ -466,6 +478,8 @@ pub mod pallet {
|
||||
NewAccount(T::AccountId),
|
||||
/// An \[account\] was reaped.
|
||||
KilledAccount(T::AccountId),
|
||||
/// On on-chain remark happened. \[origin, remark_hash\]
|
||||
Remarked(T::AccountId, T::Hash),
|
||||
}
|
||||
|
||||
/// Old name generated by `decl_event`.
|
||||
|
||||
Reference in New Issue
Block a user