mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 20:01:03 +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:
@@ -44,6 +44,12 @@ benchmarks! {
|
|||||||
let caller = whitelisted_caller();
|
let caller = whitelisted_caller();
|
||||||
}: _(RawOrigin::Signed(caller), remark_message)
|
}: _(RawOrigin::Signed(caller), remark_message)
|
||||||
|
|
||||||
|
remark_with_event {
|
||||||
|
let b in 0 .. *T::BlockLength::get().max.get(DispatchClass::Normal) as u32;
|
||||||
|
let remark_message = vec![1; b as usize];
|
||||||
|
let caller = whitelisted_caller();
|
||||||
|
}: _(RawOrigin::Signed(caller), remark_message)
|
||||||
|
|
||||||
set_heap_pages {
|
set_heap_pages {
|
||||||
}: _(RawOrigin::Root, Default::default())
|
}: _(RawOrigin::Root, Default::default())
|
||||||
|
|
||||||
|
|||||||
@@ -292,8 +292,6 @@ pub mod pallet {
|
|||||||
///
|
///
|
||||||
/// # <weight>
|
/// # <weight>
|
||||||
/// - `O(1)`
|
/// - `O(1)`
|
||||||
/// - Base Weight: 0.665 µs, independent of remark length.
|
|
||||||
/// - No DB operations.
|
|
||||||
/// # </weight>
|
/// # </weight>
|
||||||
#[pallet::weight(T::SystemWeightInfo::remark(_remark.len() as u32))]
|
#[pallet::weight(T::SystemWeightInfo::remark(_remark.len() as u32))]
|
||||||
pub(crate) fn remark(origin: OriginFor<T>, _remark: Vec<u8>) -> DispatchResultWithPostInfo {
|
pub(crate) fn remark(origin: OriginFor<T>, _remark: Vec<u8>) -> DispatchResultWithPostInfo {
|
||||||
@@ -450,11 +448,25 @@ pub mod pallet {
|
|||||||
storage::unhashed::kill_prefix(&prefix);
|
storage::unhashed::kill_prefix(&prefix);
|
||||||
Ok(().into())
|
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.
|
/// Event for the System pallet.
|
||||||
#[pallet::event]
|
#[pallet::event]
|
||||||
#[pallet::metadata(T::AccountId = "AccountId")]
|
#[pallet::metadata(T::AccountId = "AccountId", T::Hash = "Hash")]
|
||||||
pub enum Event<T: Config> {
|
pub enum Event<T: Config> {
|
||||||
/// An extrinsic completed successfully. \[info\]
|
/// An extrinsic completed successfully. \[info\]
|
||||||
ExtrinsicSuccess(DispatchInfo),
|
ExtrinsicSuccess(DispatchInfo),
|
||||||
@@ -466,6 +478,8 @@ pub mod pallet {
|
|||||||
NewAccount(T::AccountId),
|
NewAccount(T::AccountId),
|
||||||
/// An \[account\] was reaped.
|
/// An \[account\] was reaped.
|
||||||
KilledAccount(T::AccountId),
|
KilledAccount(T::AccountId),
|
||||||
|
/// On on-chain remark happened. \[origin, remark_hash\]
|
||||||
|
Remarked(T::AccountId, T::Hash),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Old name generated by `decl_event`.
|
/// Old name generated by `decl_event`.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
//! Autogenerated weights for frame_system
|
//! Autogenerated weights for frame_system
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
||||||
//! DATE: 2021-02-23, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: []
|
//! DATE: 2021-02-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: []
|
||||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
@@ -45,6 +45,7 @@ use sp_std::marker::PhantomData;
|
|||||||
/// Weight functions needed for frame_system.
|
/// Weight functions needed for frame_system.
|
||||||
pub trait WeightInfo {
|
pub trait WeightInfo {
|
||||||
fn remark(b: u32, ) -> Weight;
|
fn remark(b: u32, ) -> Weight;
|
||||||
|
fn remark_with_event(b: u32, ) -> Weight;
|
||||||
fn set_heap_pages() -> Weight;
|
fn set_heap_pages() -> Weight;
|
||||||
fn set_changes_trie_config() -> Weight;
|
fn set_changes_trie_config() -> Weight;
|
||||||
fn set_storage(i: u32, ) -> Weight;
|
fn set_storage(i: u32, ) -> Weight;
|
||||||
@@ -56,33 +57,38 @@ pub trait WeightInfo {
|
|||||||
pub struct SubstrateWeight<T>(PhantomData<T>);
|
pub struct SubstrateWeight<T>(PhantomData<T>);
|
||||||
impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
|
impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
|
||||||
fn remark(_b: u32, ) -> Weight {
|
fn remark(_b: u32, ) -> Weight {
|
||||||
(1_279_000 as Weight)
|
(1_296_000 as Weight)
|
||||||
|
}
|
||||||
|
fn remark_with_event(b: u32, ) -> Weight {
|
||||||
|
(13_474_000 as Weight)
|
||||||
|
// Standard Error: 0
|
||||||
|
.saturating_add((1_000 as Weight).saturating_mul(b as Weight))
|
||||||
}
|
}
|
||||||
fn set_heap_pages() -> Weight {
|
fn set_heap_pages() -> Weight {
|
||||||
(2_167_000 as Weight)
|
(2_024_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn set_changes_trie_config() -> Weight {
|
fn set_changes_trie_config() -> Weight {
|
||||||
(10_117_000 as Weight)
|
(10_551_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
fn set_storage(i: u32, ) -> Weight {
|
fn set_storage(i: u32, ) -> Weight {
|
||||||
(0 as Weight)
|
(0 as Weight)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add((608_000 as Weight).saturating_mul(i as Weight))
|
.saturating_add((612_000 as Weight).saturating_mul(i as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||||
}
|
}
|
||||||
fn kill_storage(i: u32, ) -> Weight {
|
fn kill_storage(i: u32, ) -> Weight {
|
||||||
(3_199_000 as Weight)
|
(562_000 as Weight)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add((450_000 as Weight).saturating_mul(i as Weight))
|
.saturating_add((442_000 as Weight).saturating_mul(i as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||||
}
|
}
|
||||||
fn kill_prefix(p: u32, ) -> Weight {
|
fn kill_prefix(p: u32, ) -> Weight {
|
||||||
(8_966_000 as Weight)
|
(10_499_000 as Weight)
|
||||||
// Standard Error: 1_000
|
// Standard Error: 1_000
|
||||||
.saturating_add((845_000 as Weight).saturating_mul(p as Weight))
|
.saturating_add((840_000 as Weight).saturating_mul(p as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
|
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,33 +96,38 @@ impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
|
|||||||
// For backwards compatibility and tests
|
// For backwards compatibility and tests
|
||||||
impl WeightInfo for () {
|
impl WeightInfo for () {
|
||||||
fn remark(_b: u32, ) -> Weight {
|
fn remark(_b: u32, ) -> Weight {
|
||||||
(1_279_000 as Weight)
|
(1_296_000 as Weight)
|
||||||
|
}
|
||||||
|
fn remark_with_event(b: u32, ) -> Weight {
|
||||||
|
(13_474_000 as Weight)
|
||||||
|
// Standard Error: 0
|
||||||
|
.saturating_add((1_000 as Weight).saturating_mul(b as Weight))
|
||||||
}
|
}
|
||||||
fn set_heap_pages() -> Weight {
|
fn set_heap_pages() -> Weight {
|
||||||
(2_167_000 as Weight)
|
(2_024_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
fn set_changes_trie_config() -> Weight {
|
fn set_changes_trie_config() -> Weight {
|
||||||
(10_117_000 as Weight)
|
(10_551_000 as Weight)
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
fn set_storage(i: u32, ) -> Weight {
|
fn set_storage(i: u32, ) -> Weight {
|
||||||
(0 as Weight)
|
(0 as Weight)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add((608_000 as Weight).saturating_mul(i as Weight))
|
.saturating_add((612_000 as Weight).saturating_mul(i as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||||
}
|
}
|
||||||
fn kill_storage(i: u32, ) -> Weight {
|
fn kill_storage(i: u32, ) -> Weight {
|
||||||
(3_199_000 as Weight)
|
(562_000 as Weight)
|
||||||
// Standard Error: 0
|
// Standard Error: 0
|
||||||
.saturating_add((450_000 as Weight).saturating_mul(i as Weight))
|
.saturating_add((442_000 as Weight).saturating_mul(i as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||||
}
|
}
|
||||||
fn kill_prefix(p: u32, ) -> Weight {
|
fn kill_prefix(p: u32, ) -> Weight {
|
||||||
(8_966_000 as Weight)
|
(10_499_000 as Weight)
|
||||||
// Standard Error: 1_000
|
// Standard Error: 1_000
|
||||||
.saturating_add((845_000 as Weight).saturating_mul(p as Weight))
|
.saturating_add((840_000 as Weight).saturating_mul(p as Weight))
|
||||||
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
|
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user