mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
Rename pallet trait Trait to Config (#7599)
* rename Trait to Config * add test asserting using Trait is still valid. * fix ui tests
This commit is contained in:
committed by
GitHub
parent
dd3c84c362
commit
1cbfc9257f
@@ -137,7 +137,7 @@ pub use sp_storage::TrackedStorageKey;
|
||||
///
|
||||
/// Test functions are automatically generated for each benchmark and are accessible to you when you
|
||||
/// run `cargo test`. All tests are named `test_benchmark_<benchmark_name>`, expect you to pass them
|
||||
/// the Runtime Trait, and run them in a test externalities environment. The test function runs your
|
||||
/// the Runtime Config, and run them in a test externalities environment. The test function runs your
|
||||
/// benchmark just like a regular benchmark, but only testing at the lowest and highest values for
|
||||
/// each component. The function will return `Ok(())` if the benchmarks return no errors.
|
||||
///
|
||||
@@ -636,7 +636,7 @@ macro_rules! benchmark_backend {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct $name;
|
||||
#[allow(unused_variables)]
|
||||
impl<T: Trait $( <$instance>, I: Instance)? >
|
||||
impl<T: Config $( <$instance>, I: Instance)? >
|
||||
$crate::BenchmarkingSetup<T $(, $instance)? > for $name
|
||||
where $( $where_clause )*
|
||||
{
|
||||
@@ -710,7 +710,7 @@ macro_rules! selected_benchmark {
|
||||
}
|
||||
|
||||
// Allow us to select a benchmark from the list of available benchmarks.
|
||||
impl<T: Trait $( <$instance>, I: Instance )? >
|
||||
impl<T: Config $( <$instance>, I: Instance )? >
|
||||
$crate::BenchmarkingSetup<T $(, $instance )? > for SelectedBenchmark
|
||||
where $( $where_clause )*
|
||||
{
|
||||
@@ -750,9 +750,9 @@ macro_rules! impl_benchmark {
|
||||
( $( { $( $name_inst:ident )? } $name:ident )* )
|
||||
( $( $name_extra:ident ),* )
|
||||
) => {
|
||||
impl<T: Trait $(<$instance>, I: Instance)? >
|
||||
impl<T: Config $(<$instance>, I: Instance)? >
|
||||
$crate::Benchmarking<$crate::BenchmarkResults> for Module<T $(, $instance)? >
|
||||
where T: frame_system::Trait, $( $where_clause )*
|
||||
where T: frame_system::Config, $( $where_clause )*
|
||||
{
|
||||
fn benchmarks(extra: bool) -> Vec<&'static [u8]> {
|
||||
let mut all = vec![ $( stringify!($name).as_ref() ),* ];
|
||||
@@ -948,8 +948,8 @@ macro_rules! impl_benchmark_test {
|
||||
$name:ident
|
||||
) => {
|
||||
$crate::paste::item! {
|
||||
fn [<test_benchmark_ $name>] <T: Trait > () -> Result<(), &'static str>
|
||||
where T: frame_system::Trait, $( $where_clause )*
|
||||
fn [<test_benchmark_ $name>] <T: Config > () -> Result<(), &'static str>
|
||||
where T: frame_system::Config, $( $where_clause )*
|
||||
{
|
||||
let selected_benchmark = SelectedBenchmark::$name;
|
||||
let components = <
|
||||
|
||||
@@ -29,16 +29,16 @@ use frame_support::{
|
||||
use frame_system::{RawOrigin, ensure_signed, ensure_none};
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait> as Test where
|
||||
<T as OtherTrait>::OtherEvent: Into<<T as Trait>::Event>
|
||||
trait Store for Module<T: Config> as Test where
|
||||
<T as OtherTrait>::OtherEvent: Into<<T as Config>::Event>
|
||||
{
|
||||
Value get(fn value): Option<u32>;
|
||||
}
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where
|
||||
origin: T::Origin, <T as OtherTrait>::OtherEvent: Into<<T as Trait>::Event>
|
||||
pub struct Module<T: Config> for enum Call where
|
||||
origin: T::Origin, <T as OtherTrait>::OtherEvent: Into<<T as Config>::Event>
|
||||
{
|
||||
#[weight = 0]
|
||||
fn set_value(origin, n: u32) -> DispatchResult {
|
||||
@@ -63,8 +63,8 @@ pub trait OtherTrait {
|
||||
type OtherEvent;
|
||||
}
|
||||
|
||||
pub trait Trait: frame_system::Trait + OtherTrait
|
||||
where Self::OtherEvent: Into<<Self as Trait>::Event>
|
||||
pub trait Config: frame_system::Config + OtherTrait
|
||||
where Self::OtherEvent: Into<<Self as Config>::Event>
|
||||
{
|
||||
type Event;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ pub trait Trait: frame_system::Trait + OtherTrait
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct Test;
|
||||
|
||||
impl frame_system::Trait for Test {
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
@@ -100,7 +100,7 @@ impl frame_system::Trait for Test {
|
||||
type SystemWeightInfo = ();
|
||||
}
|
||||
|
||||
impl Trait for Test {
|
||||
impl Config for Test {
|
||||
type Event = ();
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ fn new_test_ext() -> sp_io::TestExternalities {
|
||||
}
|
||||
|
||||
benchmarks!{
|
||||
where_clause { where <T as OtherTrait>::OtherEvent: Into<<T as Trait>::Event> }
|
||||
where_clause { where <T as OtherTrait>::OtherEvent: Into<<T as Config>::Event> }
|
||||
|
||||
_ {
|
||||
// Define a common range for `b`.
|
||||
|
||||
Reference in New Issue
Block a user