-
Notifications
You must be signed in to change notification settings - Fork 823
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
[AHM] Poke deposits: Indices pallet #7587
base: master
Are you sure you want to change the base?
[AHM] Poke deposits: Indices pallet #7587
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.
Mainly unsure about Permanent
, otherwise looks good.
From what I understand from the code, the |
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.
just minor comments
/// - `O(1)`. | ||
#[pallet::call_index(5)] | ||
#[pallet::weight(T::WeightInfo::reconsider())] | ||
pub fn reconsider( |
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.
not because of my own taste, but for the sake of consistency. how about poke_deposit
?
we already have for the same purpose poke_deposit
in some pallet, and reconsider
is the new naming.
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.
Based this off of @kianenigma 's comment here: #5591 (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.
lets wait for @kianenigma opinion. if Kian wants to keep the reconsider
anyway, it's also fine by me.
} else if new_amount < old_amount { | ||
// Need to unreserve some | ||
let excess = old_amount.saturating_sub(new_amount); | ||
T::Currency::unreserve(&who, excess); |
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.
Could possibly print some defensive failure when it cannot unreserve all, but not big issue.
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.
What would be the case when we are not able to unreserve
the required amount? This arm of if-else would be executed only when the reserved amount > deposit required. So we should always be able to unreserve the amount. Am I missing something here?
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.
In theory yes, but in practice, sadly no. We do had a few bugs in the past and sometimes it happens that accounts are missing reserves or similar.
Just double-checking this and emitting a defensive!
then gives us a hint to when this is happening such that we can investigate manually.
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.
Ah I see. Will add some logging with defensive!
, thanks!
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.
Looks very orderly, thanks!
Command "--clean" has started 🚀 See logs here |
Command "--clean" has finished ✅ See logs here |
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
Description
reconsider
topallet-indices
. This extrinsic will be used to re-adjust the deposits made in the pallet.poke
for Deposits #5591Review Notes
reconsider
inpallet-indices
.DepositReconsidered
to be emitted upon a successful call of the extrinsic.free
if an actual adjustment is made to the deposit andpaid
otherwise.TO-DOs