-
Notifications
You must be signed in to change notification settings - Fork 374
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
Fix account call for freeze/lock inconsistency #1276
Conversation
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.
LGTM, just some nitpicks
pallets/dapp-staking-v3/src/lib.rs
Outdated
@@ -386,6 +386,8 @@ pub mod pallet { | |||
NoExpiredEntries, | |||
/// Force call is not allowed in production. | |||
ForceNotAllowed, | |||
/// Account doesn't have the freeze inconsistency | |||
InvalidAccount, // TODO: can be removed after call `fix_account` is removed |
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.
nit: can be better named, AccountNotInconsistent
?
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.
I don't think there's the need for this. If account is inconsistent then there's noop tx paying just fee
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.
@ashutoshvarma sure. Believe it or not, that was the first name I choose, but decided to go with a more generic one later xD.
@ermalkaleci
I added it to make testing more clear.
It will be removed later anyways.
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.
fair enough
pallets/dapp-staking-v3/src/lib.rs
Outdated
// 2. Execute the unlock call, clearing all of the unlocking chunks. | ||
let result = Self::internal_claim_unlocked(account); | ||
|
||
// 3. Adjust consumed weight to consume the max possible weight (as defined in the weight macro). |
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.
// 3. Adjust consumed weight to consume the max possible weight (as defined in the weight macro). | |
// 3. Adjust consumed weight to consume the max possible weight (as defined in `T::WeightInfo::claim_unlocked()`). |
nit: internal_claim_unlocked()
has no weights macro, but use weights from claim_unlocked()
.
I was confused at first
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.
I mean the macro above the call: T::WeightInfo::claim_unlocked() + const.
Minimum allowed line rate is |
Pull Request Summary
Provide an approach to fix the account within an incosistent freeze state.
The approach is as simple as possible, reusing the
claim_unlocked
logic to clear unlocking chunks which are forcefully set to be immediately claimable.