mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 02:51:08 +00:00
improve staking interface methods (#14023)
* improve staking interface methods * fix * fix * fix build * restart * fix --------- Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -684,12 +684,12 @@ frame_benchmarking::benchmarks! {
|
||||
.collect();
|
||||
|
||||
assert_ok!(T::Staking::nominate(&pool_account, validators));
|
||||
assert!(T::Staking::nominations(Pools::<T>::create_bonded_account(1)).is_some());
|
||||
assert!(T::Staking::nominations(&Pools::<T>::create_bonded_account(1)).is_some());
|
||||
|
||||
whitelist_account!(depositor);
|
||||
}:_(RuntimeOrigin::Signed(depositor.clone()), 1)
|
||||
verify {
|
||||
assert!(T::Staking::nominations(Pools::<T>::create_bonded_account(1)).is_none());
|
||||
assert!(T::Staking::nominations(&Pools::<T>::create_bonded_account(1)).is_none());
|
||||
}
|
||||
|
||||
set_commission {
|
||||
|
||||
@@ -67,6 +67,14 @@ impl sp_staking::StakingInterface for StakingMock {
|
||||
BondingDuration::get()
|
||||
}
|
||||
|
||||
fn status(
|
||||
_: &Self::AccountId,
|
||||
) -> Result<sp_staking::StakerStatus<Self::AccountId>, DispatchError> {
|
||||
Nominations::get()
|
||||
.map(|noms| sp_staking::StakerStatus::Nominator(noms))
|
||||
.ok_or(DispatchError::Other("NotStash"))
|
||||
}
|
||||
|
||||
fn bond_extra(who: &Self::AccountId, extra: Self::Balance) -> DispatchResult {
|
||||
let mut x = BondedBalanceMap::get();
|
||||
x.get_mut(who).map(|v| *v += extra);
|
||||
@@ -108,7 +116,7 @@ impl sp_staking::StakingInterface for StakingMock {
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn nominations(_: Self::AccountId) -> Option<Vec<Self::AccountId>> {
|
||||
fn nominations(_: &Self::AccountId) -> Option<Vec<Self::AccountId>> {
|
||||
Nominations::get()
|
||||
}
|
||||
|
||||
@@ -116,7 +124,7 @@ impl sp_staking::StakingInterface for StakingMock {
|
||||
unimplemented!("method currently not used in testing")
|
||||
}
|
||||
|
||||
fn stake(who: &Self::AccountId) -> Result<Stake<Self>, DispatchError> {
|
||||
fn stake(who: &Self::AccountId) -> Result<Stake<Balance>, DispatchError> {
|
||||
match (
|
||||
UnbondingBalanceMap::get().get(who).copied(),
|
||||
BondedBalanceMap::get().get(who).copied(),
|
||||
|
||||
Reference in New Issue
Block a user