mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-05 17:57:25 +00:00
4c810609d6
The first step towards https://github.com/paritytech/polkadot-sdk/issues/3155 Brings all templates under the following structure ``` templates | parachain | | polkadot-launch | | runtime --> parachain-template-runtime | | pallets --> pallet-parachain-template | | node --> parachain-template-node | minimal | | runtime --> minimal-template-runtime | | pallets --> pallet-minimal-template | | node --> minimal-template-node | solochain | | runtime --> solochain-template-runtime | | pallets --> pallet-template (the naming is not consistent here) | | node --> solochain-template-node ``` The only note-worthy changes in this PR are: - More `Cargo.toml` fields are forwarded to use the one from the workspace. - parachain template now has weights and benchmarks - adds a shell pallet to the minimal template - remove a few unused deps A list of possible follow-ups: - [ ] Unify READMEs, create a parent README for all - [ ] remove references to `docs.substrate.io` in templates - [ ] make all templates use `#[derive_impl]` - [ ] update and unify all licenses - [ ] Remove polkadot launch, use https://github.com/paritytech/polkadot-sdk/blob/35349df993ea2e7c4769914ef5d199e787b23d4c/cumulus/zombienet/examples/small_network.toml instead.
36 lines
817 B
Rust
36 lines
817 B
Rust
//! Benchmarking setup for pallet-template
|
|
#![cfg(feature = "runtime-benchmarks")]
|
|
use super::*;
|
|
|
|
#[allow(unused)]
|
|
use crate::Pallet as Template;
|
|
use frame_benchmarking::v2::*;
|
|
use frame_system::RawOrigin;
|
|
|
|
#[benchmarks]
|
|
mod benchmarks {
|
|
use super::*;
|
|
|
|
#[benchmark]
|
|
fn do_something() {
|
|
let value = 100u32.into();
|
|
let caller: T::AccountId = whitelisted_caller();
|
|
#[extrinsic_call]
|
|
do_something(RawOrigin::Signed(caller), value);
|
|
|
|
assert_eq!(Something::<T>::get(), Some(value));
|
|
}
|
|
|
|
#[benchmark]
|
|
fn cause_error() {
|
|
Something::<T>::put(100u32);
|
|
let caller: T::AccountId = whitelisted_caller();
|
|
#[extrinsic_call]
|
|
cause_error(RawOrigin::Signed(caller));
|
|
|
|
assert_eq!(Something::<T>::get(), Some(101u32));
|
|
}
|
|
|
|
impl_benchmark_test_suite!(Template, crate::mock::new_test_ext(), crate::mock::Test);
|
|
}
|