mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-22 14:55:41 +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:
@@ -216,7 +216,7 @@ fn make_offenders_im_online<T: Config>(
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn check_events<T: Config, I: Iterator<Item = <T as SystemConfig>::Event>>(expected: I) {
|
||||
fn check_events<T: Config, I: Iterator<Item = <T as SystemConfig>::RuntimeEvent>>(expected: I) {
|
||||
let events = System::<T>::events()
|
||||
.into_iter()
|
||||
.map(|frame_system::EventRecord { event, .. }| event)
|
||||
@@ -308,16 +308,16 @@ benchmarks! {
|
||||
let reward_amount = slash_amount.saturating_mul(1 + n) / 2;
|
||||
let reward = reward_amount / r;
|
||||
let slash = |id| core::iter::once(
|
||||
<T as StakingConfig>::Event::from(StakingEvent::<T>::Slashed(id, BalanceOf::<T>::from(slash_amount)))
|
||||
<T as StakingConfig>::RuntimeEvent::from(StakingEvent::<T>::Slashed(id, BalanceOf::<T>::from(slash_amount)))
|
||||
);
|
||||
let balance_slash = |id| core::iter::once(
|
||||
<T as BalancesConfig>::Event::from(pallet_balances::Event::<T>::Slashed{who: id, amount: slash_amount.into()})
|
||||
<T as BalancesConfig>::RuntimeEvent::from(pallet_balances::Event::<T>::Slashed{who: id, amount: slash_amount.into()})
|
||||
);
|
||||
let chill = |id| core::iter::once(
|
||||
<T as StakingConfig>::Event::from(StakingEvent::<T>::Chilled(id))
|
||||
<T as StakingConfig>::RuntimeEvent::from(StakingEvent::<T>::Chilled(id))
|
||||
);
|
||||
let balance_deposit = |id, amount: u32|
|
||||
<T as BalancesConfig>::Event::from(pallet_balances::Event::<T>::Deposit{who: id, amount: amount.into()});
|
||||
<T as BalancesConfig>::RuntimeEvent::from(pallet_balances::Event::<T>::Deposit{who: id, amount: amount.into()});
|
||||
let mut first = true;
|
||||
let slash_events = raw_offenders.into_iter()
|
||||
.flat_map(|offender| {
|
||||
@@ -339,7 +339,7 @@ benchmarks! {
|
||||
.flat_map(|reporter| vec![
|
||||
balance_deposit(reporter.clone(), reward).into(),
|
||||
frame_system::Event::<T>::NewAccount { account: reporter.clone() }.into(),
|
||||
<T as BalancesConfig>::Event::from(
|
||||
<T as BalancesConfig>::RuntimeEvent::from(
|
||||
pallet_balances::Event::<T>::Endowed{account: reporter, free_balance: reward.into()}
|
||||
).into(),
|
||||
])
|
||||
@@ -366,7 +366,7 @@ benchmarks! {
|
||||
check_events::<T, _>(
|
||||
std::iter::empty()
|
||||
.chain(slash_events.into_iter().map(Into::into))
|
||||
.chain(std::iter::once(<T as OffencesConfig>::Event::from(
|
||||
.chain(std::iter::once(<T as OffencesConfig>::RuntimeEvent::from(
|
||||
pallet_offences::Event::Offence{
|
||||
kind: UnresponsivenessOffence::<T>::ID,
|
||||
timeslot: 0_u32.to_le_bytes().to_vec(),
|
||||
|
||||
@@ -53,13 +53,13 @@ impl frame_system::Config for Test {
|
||||
type Origin = Origin;
|
||||
type Index = AccountIndex;
|
||||
type BlockNumber = BlockNumber;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_core::H256;
|
||||
type Hashing = ::sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = AccountId;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = sp_runtime::testing::Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ();
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
@@ -77,7 +77,7 @@ impl pallet_balances::Config for Test {
|
||||
type MaxReserves = ();
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type Balance = Balance;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ConstU64<10>;
|
||||
type AccountStore = System;
|
||||
@@ -128,7 +128,7 @@ impl pallet_session::Config for Test {
|
||||
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type SessionHandler = TestSessionHandler;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ValidatorId = AccountId;
|
||||
type ValidatorIdOf = pallet_staking::StashOf<Test>;
|
||||
type WeightInfo = ();
|
||||
@@ -148,7 +148,7 @@ parameter_types! {
|
||||
pub const RewardCurve: &'static sp_runtime::curve::PiecewiseLinear<'static> = &I_NPOS;
|
||||
}
|
||||
|
||||
pub type Extrinsic = sp_runtime::testing::TestXt<Call, ()>;
|
||||
pub type Extrinsic = sp_runtime::testing::TestXt<RuntimeCall, ()>;
|
||||
|
||||
pub struct OnChainSeqPhragmen;
|
||||
impl onchain::Config for OnChainSeqPhragmen {
|
||||
@@ -165,7 +165,7 @@ impl pallet_staking::Config for Test {
|
||||
type UnixTime = pallet_timestamp::Pallet<Self>;
|
||||
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
|
||||
type RewardRemainder = ();
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Slash = ();
|
||||
type Reward = ();
|
||||
type SessionsPerEra = ();
|
||||
@@ -188,7 +188,7 @@ impl pallet_staking::Config for Test {
|
||||
|
||||
impl pallet_im_online::Config for Test {
|
||||
type AuthorityId = UintAuthorityId;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ValidatorSet = Historical;
|
||||
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type ReportUnresponsiveness = Offences;
|
||||
@@ -200,23 +200,23 @@ impl pallet_im_online::Config for Test {
|
||||
}
|
||||
|
||||
impl pallet_offences::Config for Test {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
|
||||
type OnOffenceHandler = Staking;
|
||||
}
|
||||
|
||||
impl<T> frame_system::offchain::SendTransactionTypes<T> for Test
|
||||
where
|
||||
Call: From<T>,
|
||||
RuntimeCall: From<T>,
|
||||
{
|
||||
type Extrinsic = Extrinsic;
|
||||
type OverarchingCall = Call;
|
||||
type OverarchingCall = RuntimeCall;
|
||||
}
|
||||
|
||||
impl crate::Config for Test {}
|
||||
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u64, ()>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, u64, ()>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Test where
|
||||
|
||||
Reference in New Issue
Block a user