Fix treasury so pot can be spend entirely#3797
Conversation
There was a problem hiding this comment.
Changes for this module make sense: Treasury should be able to go entirely empty, even less than ED (afaik), so AllowDeath when withdrawing from it. cc @gavofyork
I am not sure about the linked issue though. I don't see a problem with lots of (potentially PoA with less economic security at stake) chains to want ED to be zero.
I do agree that it would be good to test all modules with ED = 1 to find similar bugs.
Hence, I wouldn't close the issue with this PR but this PR as-is can be done.
|
I though that But something I just realized is that treasury won't get updated if the dilution is less than existential deposit :-/ |
|
My general sentiment is that it is okay and we should not try and make everything be compatible with everything. Treasury wants a
if we could ban |
|
OK, so this PR just make that pot can be send entirely. Note: maybe we could extend Currency trait to be able to gather some amount that could be less than ED, but this is is not done in this PR |
|
|
|
I'm ok with the idea of "fixing" the ED=0 case (i.e. accounts never get deleted); it can be easily done by checking if |
|
I don't have interest in fixing ED=0 but there is still an issue that if the proposal or burning make the treasury empty then (which is legit to happen) the treasury will keep its fund instead of being emptied. I'll fix in an overseeding PR |
Context
When you change existencialDeposit to 1 then the test
substrate/srml/treasury/src/lib.rs
Lines 591 to 604 in 7adfd83
fails at 602 because treasury hasn't been withdrawn because it wasn't allowed to.
Done