mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-22 12:35:42 +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:
@@ -28,7 +28,7 @@ use sp_runtime::traits::Bounded;
|
||||
const SEED: u32 = 0;
|
||||
const DEFAULT_DELAY: u32 = 0;
|
||||
|
||||
fn assert_last_event<T: Config>(generic_event: <T as Config>::Event) {
|
||||
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
|
||||
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ benchmarks! {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let recovered_account: T::AccountId = account("recovered_account", 0, SEED);
|
||||
let recovered_account_lookup = T::Lookup::unlookup(recovered_account.clone());
|
||||
let call: <T as Config>::Call = frame_system::Call::<T>::remark { remark: vec![] }.into();
|
||||
let call: <T as Config>::RuntimeCall = frame_system::Call::<T>::remark { remark: vec![] }.into();
|
||||
|
||||
Proxy::<T>::insert(&caller, &recovered_account);
|
||||
}: _(
|
||||
|
||||
@@ -226,13 +226,13 @@ pub mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config {
|
||||
/// 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>;
|
||||
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
|
||||
/// The overarching call type.
|
||||
type Call: Parameter
|
||||
type RuntimeCall: Parameter
|
||||
+ Dispatchable<Origin = Self::Origin, PostInfo = PostDispatchInfo>
|
||||
+ GetDispatchInfo
|
||||
+ From<frame_system::Call<Self>>;
|
||||
@@ -384,7 +384,7 @@ pub mod pallet {
|
||||
pub fn as_recovered(
|
||||
origin: OriginFor<T>,
|
||||
account: AccountIdLookupOf<T>,
|
||||
call: Box<<T as Config>::Call>,
|
||||
call: Box<<T as Config>::RuntimeCall>,
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
let account = T::Lookup::lookup(account)?;
|
||||
|
||||
@@ -56,7 +56,7 @@ impl frame_system::Config for Test {
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
@@ -64,7 +64,7 @@ impl frame_system::Config for Test {
|
||||
type AccountId = u64;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU64<250>;
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
@@ -87,7 +87,7 @@ impl pallet_balances::Config for Test {
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type Balance = u128;
|
||||
type DustRemoval = ();
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = ();
|
||||
@@ -102,9 +102,9 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl Config for Test {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type WeightInfo = ();
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Currency = Balances;
|
||||
type ConfigDepositBase = ConfigDepositBase;
|
||||
type FriendDepositFactor = FriendDepositFactor;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
use super::*;
|
||||
use frame_support::{assert_noop, assert_ok, bounded_vec, traits::Currency};
|
||||
use mock::{
|
||||
new_test_ext, run_to_block, Balances, BalancesCall, Call, MaxFriends, Origin, Recovery,
|
||||
RecoveryCall, Test,
|
||||
new_test_ext, run_to_block, Balances, BalancesCall, MaxFriends, Origin, Recovery, RecoveryCall,
|
||||
RuntimeCall, Test,
|
||||
};
|
||||
use sp_runtime::traits::BadOrigin;
|
||||
|
||||
@@ -45,7 +45,7 @@ fn set_recovered_works() {
|
||||
// Root can set a recovered account though
|
||||
assert_ok!(Recovery::set_recovered(Origin::root(), 5, 1));
|
||||
// Account 1 should now be able to make a call through account 5
|
||||
let call = Box::new(Call::Balances(BalancesCall::transfer { dest: 1, value: 100 }));
|
||||
let call = Box::new(RuntimeCall::Balances(BalancesCall::transfer { dest: 1, value: 100 }));
|
||||
assert_ok!(Recovery::as_recovered(Origin::signed(1), 5, call));
|
||||
// Account 1 has successfully drained the funds from account 5
|
||||
assert_eq!(Balances::free_balance(1), 200);
|
||||
@@ -77,15 +77,15 @@ fn recovery_life_cycle_works() {
|
||||
assert_ok!(Recovery::claim_recovery(Origin::signed(1), 5));
|
||||
// Account 1 can use account 5 to close the active recovery process, claiming the deposited
|
||||
// funds used to initiate the recovery process into account 5.
|
||||
let call = Box::new(Call::Recovery(RecoveryCall::close_recovery { rescuer: 1 }));
|
||||
let call = Box::new(RuntimeCall::Recovery(RecoveryCall::close_recovery { rescuer: 1 }));
|
||||
assert_ok!(Recovery::as_recovered(Origin::signed(1), 5, call));
|
||||
// Account 1 can then use account 5 to remove the recovery configuration, claiming the
|
||||
// deposited funds used to create the recovery configuration into account 5.
|
||||
let call = Box::new(Call::Recovery(RecoveryCall::remove_recovery {}));
|
||||
let call = Box::new(RuntimeCall::Recovery(RecoveryCall::remove_recovery {}));
|
||||
assert_ok!(Recovery::as_recovered(Origin::signed(1), 5, call));
|
||||
// Account 1 should now be able to make a call through account 5 to get all of their funds
|
||||
assert_eq!(Balances::free_balance(5), 110);
|
||||
let call = Box::new(Call::Balances(BalancesCall::transfer { dest: 1, value: 110 }));
|
||||
let call = Box::new(RuntimeCall::Balances(BalancesCall::transfer { dest: 1, value: 110 }));
|
||||
assert_ok!(Recovery::as_recovered(Origin::signed(1), 5, call));
|
||||
// All funds have been fully recovered!
|
||||
assert_eq!(Balances::free_balance(1), 200);
|
||||
|
||||
Reference in New Issue
Block a user