-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to bond extra #6984
Comments
It is this line failed polkadot-sdk/substrate/frame/staking/src/pallet/impls.rs Lines 167 to 169 in 88d900a
Relevant state at block 23965893
So it failed because |
The same logic is implemented when calling diff --git a/substrate/frame/staking/src/asset.rs b/substrate/frame/staking/src/asset.rs
index 23368b1f8fc..b939987ae72 100644
--- a/substrate/frame/staking/src/asset.rs
+++ b/substrate/frame/staking/src/asset.rs
@@ -41,7 +41,7 @@ pub fn total_balance<T: Config>(who: &T::AccountId) -> BalanceOf<T> {
///
/// This includes balance free to stake along with any balance that is already staked.
pub fn stakeable_balance<T: Config>(who: &T::AccountId) -> BalanceOf<T> {
- T::Currency::free_balance(who)
+ T::Currency::total_balance(who)
}
/// Balance of `who` that is currently at stake. |
I would like to confirm, reserved tokens can be used for staking right? #[test]
fn can_stake_reserve_balances() {
use frame_support::traits::tokens::Fortitude::Polite;
use frame_support::traits::fungible::Inspect;
use frame_support::traits::tokens::Preservation::Expendable;
use frame_support::traits::ExistenceRequirement::AllowDeath;
ExtBuilder::default().build_and_execute(|| {
// account 1 have 10 tokens
// reserve 5
let _ = Balances::reserve(&1, 5);
// check transferable balance = 10 - 5 - ED = 4
assert_eq!(Balances::reducible_balance(&1, Expendable, Polite), 4);
// stake all tokens
assert_ok!(Staking::bond(RuntimeOrigin::signed(1), 10, RewardDestination::Staked));
// only 5 is staked
assert_eq!(Staking::ledger(1.into()).unwrap().active, 5);
// transfer 4 tokens from account 1 to account 2
assert_ok!(Balances::transfer(&1, &2, 4, AllowDeath));
// check transferable balance
assert_eq!(Balances::reducible_balance(&1, Expendable, Polite), 0);
});
} So resrved token cannot be used for staking, but can be transferred out, and obviously can be used for staking on another account. I agree change Another small thing is that I made such patch locally, and all existing pallet-staking tests are passing. So test coverage on that needs improvement. |
closing as per #7047 (comment) |
Address: 14DsLzVyTUTDMm2eP3czwPbH53KgqnQRp3CJJZS9GR7yxGDP
This tx failed: https://polkadot.subscan.io/extrinsic/23965894-2
It is trying to bond extra 1 dot and I have 30+ transferable DOT and the bond failed
And I am able to transfer 1 DOT out of this account: https://polkadot.subscan.io/extrinsic/23966216-2
The text was updated successfully, but these errors were encountered: