-
Notifications
You must be signed in to change notification settings - Fork 9
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
Generalize types within cardano-coin-selection
library.
#17
Comments
cardano-coin-selection
library.cardano-coin-selection
library types.
cardano-coin-selection
library types.cardano-coin-selection
library.
@KtorZ A previous code review identified one type that could potentially be widened or generalized: https://github.com/input-output-hk/cardano-coin-selection/blob/0dfd846c68669d60fdff4f77dc8ae19ae25bf0e1/src/library/Cardano/CoinSelection.hs#L278-L283 The justification being that some blockchains might accept more than 255 inputs in a transaction. I did experiment with widening this type, and was successfully able to widen it to Of course, this value can probably be no higher than However, widening it to What should we do here?
|
Just for the record, we decided to widen the type of |
lgtm. |
Context
The
cardano-coin-selection
library currently duplicates some of the types that are defined within thecardano-wallet
library.It would be desirable to replace these duplicated types with abstract types or interfaces, allowing consumers of the library (including
cardano-wallet
) to use their own concrete types.Decision
Revise the types used in the
cardano-coin-selection
library, replacing concrete types with abstract types (or interfaces) where it makes sense.Types to Generalize
Cardano.CoinSelection.CoinSelectionLimit
This was originally defined in terms of
Word8
. It has been widened toWord16
.TxIn
(used in the inputs of aCoinSelection
)Since coin selection algorithms are agnostic to the type of input identifier, this has been replaced with the type variable
i
.Address
(used in the outputs of aCoinSelection
)Since coin selection algorithms are agnostic to the type of output identifier, this has been replaced with a type variable
o
.UTxO
This has been replaced with
CoinMap i
, wherei
refers to an input identifier type.[TxOut]
This has been replaced with
CoinMap o
, whereo
refers to an output identifier type.Hash
This has been removed, as it was part of
TxIn
which has also been removed.Coin
This was originally defined in terms of
Word64
, and has now been redefined in terms ofNatural
.Fee
This was originally defined in terms of
Word64
, and has now been redefined in terms ofCoin
(which is defined in terms ofNatural
).DustThreshold
This was originally defined in terms of
Word64
, and has now been redefined in terms ofCoin
(which is defined in terms ofNatural
).The text was updated successfully, but these errors were encountered: