-
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
Add the SelectionStrategy
type.
#3161
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes: - Use 4-space indents everywhere instead of other indent widths. - Coalesce lines that don't need to be wrapped. - Shorten excessively-long lines to fit within the 80 column limit (where practical).
…onLens`. To begin with, we give this type just a single constructor: `SelectionStrategyOptimal`.
Additionally, adjust `runSelection` to pass the value of this field through to inner functions.
Additionally, adjust `performSelection` to pass the value of this field through to inner functions.
…straints`. Additionally, adjust `toBalanceConstraintsParams` to pass the value of this field through to inner functions.
…raints`. Additionally, adjust `toInternalSelectionConstraints` to pass the value of this field through to inner functions.
Additionally, adjust `selectAssets` to pass the value of this field through to inner functions.
Anviking
approved these changes
Mar 4, 2022
bors r+ |
Build succeeded: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Number
ADP-1499
Summary
This PR is intended to be a pure refactoring, with no changes to behaviour. It adds the
SelectionStrategy
type to the coin selection library, which will eventually be defined as:This PR adds only the
SelectionStrategyOptimal
constructor: this strategy corresponds to the existing behaviour of coin selection.A future PR will add the
SelectionStrategyMinimal
constructor, along with appropriate test coverage.Explanation
These two strategies are intended to correspond to the following behaviours:
Specifying the optimal strategy (currently the default) should cause the coin selection algorithm to attempt to select around twice the minimum possible amount of each asset from the available UTxO set, making it possible to generate change outputs that are roughly the same sizes and shapes as the user-specified outputs.
Specifying the minimal strategy should cause the coin selection algorithm to select just enough of each asset from the available UTxO set to meet the minimum amount. When the minimum amount of each asset is satisfied, coin selection should terminate. This strategy, if used frequently, may sacrifice the long-term health of the wallet’s UTxO distribution, as it’s likely to produce a greater concentration of dust values. Therefore, it should only be used as a fallback: i.e., if using the optimal strategy produces a selection that is too large.