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

migration algorithm exits without processing all inputs. #85

Open
KtorZ opened this issue Jul 24, 2020 · 0 comments
Open

migration algorithm exits without processing all inputs. #85

KtorZ opened this issue Jul 24, 2020 · 0 comments
Labels
bug Something isn't working confirmed

Comments

@KtorZ
Copy link
Contributor

KtorZ commented Jul 24, 2020

Context

The migration algorithm is an iterative algorithm, which attempts to construct several coin selections in order to deplete a wallet. An initial "ideal batch size" is calculated beforehand, and then, the algorithm proceed to construct selections from batch of inputs of that ideal size (modulo the last batch).

Constructing a selection also means balancing it. Here, the algorithm will depletes change outputs until reaching an equilibrium and will take care of filtering out dust coins that are below a certain threshold.

There are cases where a given selection could not produce any value (all change output are below the threshold).

Expected Behavior

The algorithm should discard such "no-value" selections, and continue processing next batches until it has traversed all batches.

Current Behavior

The algorithm stops at the first "no-value" selections and returns, with whatever selections has been accumulated this far, possibly leaving many inputs behind.

Resolution

https://github.com/input-output-hk/cardano-coin-selection/blob/cff368d674fe58bc1a12e6564a26ccea21eb5aac/src/library/Cardano/CoinSelection/Algorithm/Migration.hs#L108-L112

The issue is the handling of the Nothing branch ☝️ which should not be pure [] (terminal case of the recursion) but simply migrate, discarding the ongoing selection, but continuing migrating others.

@KtorZ KtorZ added bug Something isn't working confirmed labels Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed
Projects
None yet
Development

No branches or pull requests

1 participant