-
Notifications
You must be signed in to change notification settings - Fork 217
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
Allow constructing change output from _any_ input #2484
Allow constructing change output from _any_ input #2484
Conversation
let inputsSelected = mkInputsSelected selected | ||
let changeSkeleton = NE.toList $ predictChange selected |
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.
I've moved this here inside the function body because now, it is possible for the predicted change to change on each iteration due to the selection of new multi-asset outputs.
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.
With the change I am successfully able to send MA tx which was giving me "cannot_cover_fee" error before despite my balance was enough to cover tx/fee.
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 fine to me!
A tiny amount of rebasing will be necessary after #2482 merges. (Since [SelectionFilter]
has changed to NonEmpty SelectionFilter
.)
In only a few days, this has proven to be a quite major issue users have been running into. The thing is that we can't really control how the shape of the UTxO evolves. Quite easily, a user can end up with large quantity of Ada bound to a particular asset. Before this commit, when transacting on other assets, these Ada would've been locked and the user will be granted with a 'cannot_cover_fee' error, despite having plenty of Ada in his/her wallet. However, because of the way we construct change outputs, it is rather safe and easy to also select from any inputs and construct change outputs accordingly. As a matter of fact, the change construction is an iterative trial-and-error process. That is, it works in the following steps: - From a given set of input, try to construct valid change output to cover for the transaction need - If impossible, select another input and try again. Selecting an extra input which contains some potentially new assets will result in a completely different change output. However, since we are re-construct the entire change output sets on each iteration, it doesn't matter much. This processus is still imperfect in the sense that there may be some valid subset of the selection which can result in a valid transaction, whereas some other path may not.
312b0b1
to
63ce689
Compare
bors merge please. |
Build succeeded: |
Issue Number
ADP-345
Overview
312b0b1
📍 allow constructing change output from any input
In only a few days, this has proven to be a quite major issue users have been running into. The thing is that we can't really control how the shape of the UTxO evolves. Quite easily, a user can end up with large quantity of Ada bound to a particular asset. Before this commit, when transacting on other assets, these Ada would've been locked and the user will be granted with a 'cannot_cover_fee' error, despite having plenty of Ada in his/her wallet. However, because of the way we construct change outputs, it is rather safe and easy to also select from any inputs and construct change outputs accordingly.
As a matter of fact, the change construction is an iterative trial-and-error process. That is, it works in the following steps:
Selecting an extra input which contains some potentially new assets will result in a completely different change output. However, since we are re-construct the entire change output sets on each iteration, it doesn't matter much. This processus is still imperfect in the sense that there may be some valid subset of the selection which can result in a valid transaction, whereas some other path may not. Yet, such cases should be rare and "edgy" in practice.
Comments