-
Notifications
You must be signed in to change notification settings - Fork 1
Locking + autocompounding #48
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
base: feat/optimized-rewrads
Are you sure you want to change the base?
Conversation
Balance: Saturating + Copy, | ||
{ | ||
/// Returns the total amount of locked balance that is not part of staking. | ||
pub fn total(&self) -> Balance { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name is misleading as it is not the total locked balance as you perfectly explain on the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And how'd you name it then? 🤔
I mean, I don't think a very verbose name is the solution. That's why I added the comment for.
pub type NextSystemOperation<T: Config> = StorageValue<_, OperationFor<T>, ValueQuery>; | ||
|
||
#[pallet::storage] | ||
pub type LockedBalances<T: Config> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also a comment here could help to understand that this is the non staked locked balance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 617cb00.
src/migrations/v2.rs
Outdated
let bond = | ||
T::Currency::balance_frozen(&FreezeReason::CandidacyBond.into(), &candidate); | ||
let _ = T::Currency::thaw(&FreezeReason::CandidacyBond.into(), &candidate); | ||
let _ = T::Currency::thaw(&FreezeReason::Releasing.into(), &candidate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please elaborate on why it is also needed also on the candidacy_bond migration when it is addressed on the release_queue migration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because releasing the candidacy bond does not create an element in the release queue that gets inspected. That was actually a bug detected in the previous security audit which forced us to have a separate mechanism for handling the release of the candidacy bond, yet that amount gets locked under the Releasing
reason.
Overview
This pull request introduces two major features to the
pallet-collator-staking
module:Features
1. Locking
2. Autocompounding
Implementation Notes
lock_stake
unlock_stake
enable_autocompound
disable_autocompound
Migration