mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 03:21:06 +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:
@@ -134,13 +134,13 @@ impl frame_system::Config for Test {
|
||||
type Origin = Origin;
|
||||
type Index = AccountIndex;
|
||||
type BlockNumber = BlockNumber;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = H256;
|
||||
type Hashing = ::sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = AccountId;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU64<250>;
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
@@ -157,7 +157,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 = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
@@ -174,7 +174,7 @@ impl pallet_session::Config for Test {
|
||||
type Keys = SessionKeys;
|
||||
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type SessionHandler = (OtherSessionHandler,);
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ValidatorId = AccountId;
|
||||
type ValidatorIdOf = crate::StashOf<Test>;
|
||||
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
@@ -241,7 +241,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl pallet_bags_list::Config for Test {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type WeightInfo = ();
|
||||
type ScoreProvider = Staking;
|
||||
type BagThresholds = BagThresholds;
|
||||
@@ -281,7 +281,7 @@ impl crate::pallet::pallet::Config for Test {
|
||||
type UnixTime = Timestamp;
|
||||
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
|
||||
type RewardRemainder = RewardRemainderMock;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Slash = ();
|
||||
type Reward = MockReward;
|
||||
type SessionsPerEra = SessionsPerEra;
|
||||
@@ -304,7 +304,7 @@ impl crate::pallet::pallet::Config for Test {
|
||||
}
|
||||
|
||||
pub(crate) type StakingCall = crate::Call<Test>;
|
||||
pub(crate) type TestRuntimeCall = <Test as frame_system::Config>::Call;
|
||||
pub(crate) type TestCall = <Test as frame_system::Config>::RuntimeCall;
|
||||
|
||||
pub struct ExtBuilder {
|
||||
nominate: bool,
|
||||
@@ -871,7 +871,7 @@ pub(crate) fn staking_events() -> Vec<crate::Event<Test>> {
|
||||
System::events()
|
||||
.into_iter()
|
||||
.map(|r| r.event)
|
||||
.filter_map(|e| if let Event::Staking(inner) = e { Some(inner) } else { None })
|
||||
.filter_map(|e| if let RuntimeEvent::Staking(inner) = e { Some(inner) } else { None })
|
||||
.collect()
|
||||
}
|
||||
|
||||
@@ -882,7 +882,7 @@ parameter_types! {
|
||||
pub(crate) fn staking_events_since_last_call() -> Vec<crate::Event<Test>> {
|
||||
let all: Vec<_> = System::events()
|
||||
.into_iter()
|
||||
.filter_map(|r| if let Event::Staking(inner) = r.event { Some(inner) } else { None })
|
||||
.filter_map(|r| if let RuntimeEvent::Staking(inner) = r.event { Some(inner) } else { None })
|
||||
.collect();
|
||||
let seen = StakingEventsIndex::get();
|
||||
StakingEventsIndex::set(all.len());
|
||||
|
||||
@@ -129,7 +129,7 @@ pub mod pallet {
|
||||
type RewardRemainder: OnUnbalanced<NegativeImbalanceOf<Self>>;
|
||||
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
|
||||
/// Handler for the unbalanced reduction when slashing a staker.
|
||||
type Slash: OnUnbalanced<NegativeImbalanceOf<Self>>;
|
||||
|
||||
@@ -3779,8 +3779,7 @@ fn payout_stakers_handles_weight_refund() {
|
||||
start_active_era(2);
|
||||
|
||||
// Collect payouts when there are no nominators
|
||||
let call =
|
||||
TestRuntimeCall::Staking(StakingCall::payout_stakers { validator_stash: 11, era: 1 });
|
||||
let call = TestCall::Staking(StakingCall::payout_stakers { validator_stash: 11, era: 1 });
|
||||
let info = call.get_dispatch_info();
|
||||
let result = call.dispatch(Origin::signed(20));
|
||||
assert_ok!(result);
|
||||
@@ -3793,8 +3792,7 @@ fn payout_stakers_handles_weight_refund() {
|
||||
start_active_era(3);
|
||||
|
||||
// Collect payouts for an era where the validator did not receive any points.
|
||||
let call =
|
||||
TestRuntimeCall::Staking(StakingCall::payout_stakers { validator_stash: 11, era: 2 });
|
||||
let call = TestCall::Staking(StakingCall::payout_stakers { validator_stash: 11, era: 2 });
|
||||
let info = call.get_dispatch_info();
|
||||
let result = call.dispatch(Origin::signed(20));
|
||||
assert_ok!(result);
|
||||
@@ -3807,8 +3805,7 @@ fn payout_stakers_handles_weight_refund() {
|
||||
start_active_era(4);
|
||||
|
||||
// Collect payouts when the validator has `half_max_nom_rewarded` nominators.
|
||||
let call =
|
||||
TestRuntimeCall::Staking(StakingCall::payout_stakers { validator_stash: 11, era: 3 });
|
||||
let call = TestCall::Staking(StakingCall::payout_stakers { validator_stash: 11, era: 3 });
|
||||
let info = call.get_dispatch_info();
|
||||
let result = call.dispatch(Origin::signed(20));
|
||||
assert_ok!(result);
|
||||
@@ -3831,16 +3828,14 @@ fn payout_stakers_handles_weight_refund() {
|
||||
start_active_era(6);
|
||||
|
||||
// Collect payouts when the validator had `half_max_nom_rewarded` nominators.
|
||||
let call =
|
||||
TestRuntimeCall::Staking(StakingCall::payout_stakers { validator_stash: 11, era: 5 });
|
||||
let call = TestCall::Staking(StakingCall::payout_stakers { validator_stash: 11, era: 5 });
|
||||
let info = call.get_dispatch_info();
|
||||
let result = call.dispatch(Origin::signed(20));
|
||||
assert_ok!(result);
|
||||
assert_eq!(extract_actual_weight(&result, &info), max_nom_rewarded_weight);
|
||||
|
||||
// Try and collect payouts for an era that has already been collected.
|
||||
let call =
|
||||
TestRuntimeCall::Staking(StakingCall::payout_stakers { validator_stash: 11, era: 5 });
|
||||
let call = TestCall::Staking(StakingCall::payout_stakers { validator_stash: 11, era: 5 });
|
||||
let info = call.get_dispatch_info();
|
||||
let result = call.dispatch(Origin::signed(20));
|
||||
assert!(result.is_err());
|
||||
|
||||
Reference in New Issue
Block a user