-
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
Remove hard-coded dependency on txOutMax{Coin,TokenQuantity}
within coin selection modules
#3197
Remove hard-coded dependency on txOutMax{Coin,TokenQuantity}
within coin selection modules
#3197
Conversation
Instead of `txOutMaxCoin`, which was imported from the wallet.
txOutMax{Coin,TokenQuantity}
from coin selectiontxOutMax{Coin,TokenQuantity}
from Coin Selection
txOutMax{Coin,TokenQuantity}
from Coin SelectiontxOutMax{Coin,TokenQuantity}
within coin selection modules
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.
👍
Actually, wouldn't it be better to hard-code these inside coin-selection? As long as coin-selection is specific to the Cardano blockchain (and as long they the two fields are not added to the PParams), there would be no need for any kind of user to provide any different value, right? |
Ah, it seems you want to be able to vary these for testing, which seems like a good reason. But when we create the main interface for the haskell+cardano-api-dependent coin-selection library, I think we should ensure these two fields are not part of it. (This might trivially end up being the case, if we take a |
bors r+ |
Build succeeded: |
Definitely, that was also my thinking. 👍🏻 This PR is just so that the internal coin selection modules:
For example, it might be nice to generate smaller values to provoke the splitting of token bundles more frequently, to check that properties still hold. |
Issue Number
ADP-1481
Summary
This PR adjusts the internal coin selection modules so that they no longer depend on hard-coded maximum token quantity constants imported from the wallet.
Instead, these constants are now passed in to coin selection as part of
SelectionConstraints
.There is no impact on the wallet itself, since these dependencies are injected in automatically by the
Cardano.Wallet.CoinSelection
module, which provides a wallet-friendly interface to coin selection.Future Work
We intend to eventually adjust coin selection so that it does not discriminate between ada and non-ada quantities. (See https://input-output.atlassian.net/browse/ADP-1449). When that moment comes, we may want to replace these two constants with a function similar to:
Then, callers of coin selection can provide a function that meets their requirements. If the requirement is still to have different limits for ada and non-ada quantities, then this can be encoded in the function.
Or, if we can get away with a single limit for all asset types (including ada), then we can reduce this to a single constant.