substrate
substrate copied to clipboard
Issue with deposit_creating in Currency trait
Is there an existing issue?
- [X] I have searched the existing issues
Experiencing problems? Have you tried our Stack Exchange first?
- [X] This is not a support question.
Description of bug
Hello!
I raised an issue recently in polkadot repo regarding XCM's CurrencyAdapter
, however I was told this is more of a issue with the Currency
trait.
Basically, the issue is with deposit_creating
function which returns PositiveImbalance
and is documented as infallible.
/// Adds up to `value` to the free balance of `who`. If `who` doesn't exist, it is created.
///
/// Infallible.
fn deposit_creating(who: &AccountId, value: Self::Balance) -> Self::PositiveImbalance;
However, in case when the deposited value doesn't satisfy the existential requirement, the operation will soft fail, returning Zero
equivalent of PositiveImbalance
. The ExistentialDeposit
error information is lost/hidden which seems wrong (code is here).
Should this be changed to return a Result
instead?
Steps to reproduce
No response