-
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
Provide integrated coin selection module #2859
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
jonathanknowles
force-pushed
the
jonathanknowles/integrated-coin-selection
branch
2 times, most recently
from
August 30, 2021 01:30
eea5926
to
64f1bf7
Compare
Use `Integrated.performSelection` from `Cardano.Wallet`.
Use this type within `Cardano.Wallet` when calling `performSelection`.
Use this type within `Cardano.Wallet` when calling `performSelection`.
This value is passed in, only to be returned without any modification.
…ter. This is consistent with the name of the protocol parameter in our API.
This refers to a transaction context, rather than a transaction.
jonathanknowles
force-pushed
the
jonathanknowles/integrated-coin-selection
branch
from
August 30, 2021 01:31
64f1bf7
to
eaf3fdb
Compare
jonathanknowles
changed the title
Provide integrated coin selection layer
Provide integrated coin selection module
Aug 30, 2021
This commit makes some minor tweaks to names: - module `CoinSelection.Integrated` -> `CoinSelection` - module `CoinSelection.Balanced` -> `CoinSelection.Balance` - type `CoinSelection.SelectionData` -> `CoinSelection.SelectionParams`
jonathanknowles
force-pushed
the
jonathanknowles/integrated-coin-selection
branch
from
August 30, 2021 05:10
eaf3fdb
to
d64662d
Compare
jonathanknowles
force-pushed
the
jonathanknowles/integrated-coin-selection
branch
from
August 30, 2021 05:12
d64662d
to
20f3c18
Compare
sevanspowell
approved these changes
Aug 30, 2021
bors r+ |
iohk-bors bot
added a commit
that referenced
this pull request
Aug 30, 2021
2859: Provide integrated coin selection module r=jonathanknowles a=jonathanknowles ## Issue Numbers - ADP-1037 - ADP-1070 ## Overview This PR is intended to be a **_pure refactoring_**, with no behavioural changes. It provides a **basis for future work**, including: - adjusting coin selection and fee estimation to handle collateral inputs (ADP-1037). - adjusting coin selection and fee estimation to handle pre-existing inputs (ADP-1070). ## Details This PR makes the following changes: - Adds a top-level `CoinSelection` module with a `performSelection` function. This function currently just _delegates_ to the ordinary input selection algorithm, but will eventually provide the machinery to co-ordinate **_both_** ordinary input selection (`CoinSelection.Balance`) **_and_** collateral input selection (`CoinSelection.Collateral`). - Adjusts `Wallet.selectAssets` to use the top-level `CoinSelection.performSelection` function. - Moves the `prepareOutputs` function (preparing user-specified outputs) **_out of_** the `TransactionLayer` and **_into_** the top-level `CoinSelection` module. (Arguably this should never have been in the transaction layer, as it is only relevant to coin selection.) - Creates a `SelectionConstraints` type, which groups together all constraint functions (functions that are dependent on protocol parameters) relevant to coin selection into a single place: ```hs data SelectionConstraints = SelectionConstraints { assessTokenBundleSize :: TokenBundleSizeAssessor , computeMinimumAdaQuantity :: TokenMap -> Coin , computeMinimumCost :: SelectionSkeleton -> Coin , computeSelectionLimit :: [TxOut] -> SelectionLimit , maximumCollateralInputCount :: Word16 } ``` Co-authored-by: Jonathan Knowles <[email protected]>
Build failed: |
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 Numbers
Overview
This PR is intended to be a pure refactoring, with no behavioural changes.
It provides a basis for future work, including:
Details
This PR makes the following changes:
Adds a top-level
CoinSelection
module with aperformSelection
function. This function currently just delegates to the ordinary input selection algorithm, but will eventually provide the machinery to co-ordinate both ordinary input selection (CoinSelection.Balance
) and collateral input selection (CoinSelection.Collateral
).Adjusts
Wallet.selectAssets
to use the top-levelCoinSelection.performSelection
function.Moves the
prepareOutputs
function (preparing user-specified outputs) out of theTransactionLayer
and into the top-levelCoinSelection
module. (Arguably this should never have been in the transaction layer, as it is only relevant to coin selection.)Creates a
SelectionConstraints
type, which groups together all constraint functions (functions that are dependent on protocol parameters) relevant to coin selection into a single place: