-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[Feature] Add deposit to fast-unstake #12366
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.
Logic looks good, but please:
- use a smaller number for deposit in mock.rs
- don't hardcode the value anywhere (unless if really needed)
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
if !remaining.is_zero() { | ||
frame_support::defensive!("`not enough balance to unreserve`"); | ||
ErasToCheckPerBlock::<T>::put(0); | ||
Self::deposit_event(Event::<T>::InternalError) |
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.
This then goes on to be Ok(()) - should it be an error?
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.
That's alright, it has defensive checks, what this basically means is that this should always be a defensive path and if it happens - that'd panic.
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 in prod scenario this simply disables the pallet until further notice.
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.
yes -- a defensive code path is one that should never happen. We're just coding what should happen in case there's a bug. Returning Ok(()), and
ErasToCheckPerBlock::<T>::put(0);
Self::deposit_event(Event::<T>::InternalError)
is as good as it gets.
/cmd queue -c fmt $ 1 |
@ruseinov https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1890181 was started for your command Comment |
@ruseinov Command |
bot merge |
Waiting for commit status. |
* [Feature] Add deposit to fast-unstake * disable on ErasToCheckPerBlock == 0 * removed signed ext * remove obsolete import * remove some obsolete stuff * fix some comments * fixed all the comments * remove obsolete imports * fix some tests * CallNotAllowed tests * Update frame/fast-unstake/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * fix tests * fix deregister + tests * more fixes * make sure we go above existential deposit * fixed the last test * some nit fixes * fix node * fix bench * last bench fix * Update frame/fast-unstake/src/lib.rs * ".git/.scripts/fmt.sh" 1 Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: command-bot <>
No description provided.