mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 19:11:04 +00:00
Staking: chill_other takes stash instead of controller (#2501)
The `chill_other` call is the only staking call that explicitly requires `controller` in its signature. This PR changes the controller arg to be the stash instead, with `StakingLedger` then fetching the controller from storage. This is not a breaking change per se - the call types do not change, but is noteworthy as UIs will now want to pass the stash account into `chill_other` calls, & metadata will reflect this. Note: This is very low impact. `chill_other` has [hardly ever been used](https://polkadot.subscan.io/extrinsic?address=&module=staking&call=chill_other&result=all&signedChecked=signed%20only&startDate=&endDate=&startBlock=&timeType=date&version=9431&endBlock=) on Polkadot - notwithstanding the one called 11 days ago at block 18177457 that was a part of test I did, the last call was made 493 days ago. Only 2 calls have ever been successful. Addresses controller deprecation #2500 --------- Co-authored-by: command-bot <> Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>
This commit is contained in:
@@ -1327,7 +1327,7 @@ pub mod pallet {
|
||||
// (temporary) passive migration.
|
||||
Self::ledger(StakingAccount::Stash(stash.clone())).map(|ledger| {
|
||||
let controller = ledger.controller()
|
||||
.defensive_proof("ledger was fetched used the StakingInterface, so controller field must exist; qed.")
|
||||
.defensive_proof("Ledger's controller field didn't exist. The controller should have been fetched using StakingLedger.")
|
||||
.ok_or(Error::<T>::NotController)?;
|
||||
|
||||
if controller == stash {
|
||||
@@ -1764,11 +1764,16 @@ pub mod pallet {
|
||||
/// who do not satisfy these requirements.
|
||||
#[pallet::call_index(23)]
|
||||
#[pallet::weight(T::WeightInfo::chill_other())]
|
||||
pub fn chill_other(origin: OriginFor<T>, controller: T::AccountId) -> DispatchResult {
|
||||
pub fn chill_other(origin: OriginFor<T>, stash: T::AccountId) -> DispatchResult {
|
||||
// Anyone can call this function.
|
||||
let caller = ensure_signed(origin)?;
|
||||
let ledger = Self::ledger(Controller(controller.clone()))?;
|
||||
let stash = ledger.stash;
|
||||
let ledger = Self::ledger(Stash(stash.clone()))?;
|
||||
let controller = ledger
|
||||
.controller()
|
||||
.defensive_proof(
|
||||
"Ledger's controller field didn't exist. The controller should have been fetched using StakingLedger.",
|
||||
)
|
||||
.ok_or(Error::<T>::NotController)?;
|
||||
|
||||
// In order for one user to chill another user, the following conditions must be met:
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user