Skip to content
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

Coin selection - change output min ada #131

Open
nicolasayotte opened this issue Sep 29, 2022 · 0 comments
Open

Coin selection - change output min ada #131

nicolasayotte opened this issue Sep 29, 2022 · 0 comments

Comments

@nicolasayotte
Copy link

During the coin selection process it is crucial to create the change output and calculate it's min ada every time you add an input. This min ada needs to be added to the target ada in the coin selection.

Example of a broken case:

Let's say you pick a utxo with 30 ada + 150 NFTs, the current algorithm thinks: great! 30 ada! My target was 10 ada, I have triple: I am done here. And the tx breaks when building the change output.

CTL does that correctly lines 240:249 of :
https://github.com/Plutonomicon/cardano-transaction-lib/blob/develop/src/Internal/BalanceTx/BalanceTx.purs

CML would need to implement something similar so that it doesn't break on the example I explained at the beginning. A test could easily be added to ensure the fix works. That would be during the CIP-2 (ish) implementations, after you get all your Assets and during the loop that gathers Ada.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant