-
Notifications
You must be signed in to change notification settings - Fork 14
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
Use truly free balance (liquid) in chain extension #501
Use truly free balance (liquid) in chain extension #501
Conversation
@gianfra-t is this ready for review? You didn't add reviewers. |
Yes @ebma it is, but tests are failing (I was waiting for them). I will check if it is related. |
2752d4d
to
1b7d4fa
Compare
I will ran format afterwards since it will as always complicate the review of actual changes. |
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.
Interesting, I didn't know about the reducible_balance
function. Makes sense to use it but unfortunate that it's not implemented on the MultiCurrency
trait.
Looks good to me overall 👍
I merged this even if the CI showed a failure, because locally when running the last |
Is the failing CI due to clippy? Isn't it the Test job that fails with the following error?
|
But that has been a very common log we see almost always we start the chain in tests. I doubt it will make the CI fail. It almost seems like it didn't run the last 3 jobs. |
Ohhh I checked the logs of the CI again and I see:
So that's it. |
Closes #483
Uses the
reducible_balance
fn from theInspect
trait. This is the truly liquid balance see here oforml_tokens
and here forpallet_balances
. Here frozen has a different meaning but the meaning of liquid is the same judging by how both use it in theirtransfer_all
function.There is no need to substract from
reserved
since these free and reserved are already mutually exclusive (see the reserve extrinsic).Why not use MultiCurrency
Sadly, this trait does not implement the notion of a reducible balance nor of a frozen balance. It does implement this notion in
ensure_can_withdraw
but this won't actually tell us the amount, so theInspect
trait seems to be the only choice (that I could find).But this means we need to match between the native and token variants, which is not very ergonomic. Also, the return is encoded to avoid mismatches of
Balance
type.