Skip to content
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

Convert to using balance locks in staking #353

Open
gztensor opened this issue Apr 22, 2024 · 1 comment
Open

Convert to using balance locks in staking #353

gztensor opened this issue Apr 22, 2024 · 1 comment
Labels
bug Something isn't working needs-triage

Comments

@gztensor
Copy link
Contributor

Describe the bug

Currently staking is affected by existential deposit because it is using Currency::withdraw (and Currency::deposit for unstaking). Pallet balances has the locking mechanism for this, which does not affect the total balance of the account, but effectively locks the currency.

The staking/unstaking logic of working with balances is located in remove_balance_from_coldkey_account and add_balance_to_coldkey_account

To Reproduce

Stake full amount less transaction fees.
Result: Staked amount is less by ED (or account is wiped, unsure).

Expected behavior

Staked amount can be full balance and account does not get dust-collected.

Screenshots

No response

Environment

Any

Additional context

No response

@gztensor gztensor added the bug Something isn't working label Apr 22, 2024
@distributedstatemachine
Copy link
Collaborator

It is not possible to stake the full amount , as this deducts the freebalance. the Preservation ensures that the account is not reaped

/// The mode by which we describe whether an operation should keep an account alive.
#[derive(Copy, Clone, RuntimeDebug, Eq, PartialEq)]
pub enum Preservation {
	/// We don't care if the account gets killed by this operation.
	Expendable,
	/// The account may not be killed, but we don't care if the balance gets dusted.
	Protect,
	/// The account may not be killed and our provider reference must remain (in the context of
	/// tokens, this means that the account may not be dusted).
	Preserve,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

2 participants