This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Do not allow zero Existential Deposit when using Balances #4894
Merged
gavofyork
merged 14 commits into
paritytech:master
from
shawntabrizi:shawntabrizi-nonzero-ed
Feb 12, 2020
Merged
Do not allow zero Existential Deposit when using Balances #4894
gavofyork
merged 14 commits into
paritytech:master
from
shawntabrizi:shawntabrizi-nonzero-ed
Feb 12, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shawntabrizi
commented
Feb 11, 2020
@@ -788,7 +788,7 @@ decl_module! { | |||
let mut payouts = <Payouts<T, I>>::get(&who); | |||
if let Some((when, amount)) = payouts.first() { | |||
if when <= &<system::Module<T>>::block_number() { | |||
T::Currency::transfer(&Self::payouts(), &who, *amount, KeepAlive)?; | |||
T::Currency::transfer(&Self::payouts(), &who, *amount, AllowDeath)?; |
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.
@gavofyork: ping on this change
The payouts
transfer allow death in all the other parts of the code. I assume this was just missed.
A user should be able to get paid out using the full funds of the payouts
account.
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 fixes a test which was failing now that ED is non-zero, and we weren't allowing a full payout.
bkchr
approved these changes
Feb 11, 2020
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
…rizi/substrate into shawntabrizi-nonzero-ed
1 task
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3798
The balances module uses comparison operators within it's logic which assume that the existential deposit is some non-zero value.
However, many of our tests use ED of 0 which may result in unexpected behaviors when actually deploying to a real environment.
Here we add a check that the ED of the balances module is non-zero in the construction of the genesis to prevent potential issues on live chains where they may try to set the value to 0.
Additionally, we update all Pallets to have an ED > 0 for their tests.