cardano-foundation / cardano-wallet

HTTP server & command-line for managing UTxOs and HD wallets in Cardano.
Apache License 2.0
764 stars 212 forks source link

[ADP-3272] Remove `cardano-api` conversions from `Arbitrary` instance for `PartialTx era`. #4558

Closed jonathanknowles closed 5 months ago

jonathanknowles commented 5 months ago

This PR redefines the Arbitrary instance for PartialTx era in terms of the following generators and shrinkers that use ledger types:

genTxForBalancing :: IsRecentEra era => Gen (Tx era)
genTxOut          :: IsRecentEra era => Gen (TxOut era)
shrinkTx          :: IsRecentEra era => Tx era -> [Tx era]

Internally, these generators and shrinkers may still use conversions to and from cardano-api types, but those conversions no longer leak out into code that calls them.

Importantly, this allows the definition of Arbitrary for PartialTx era to be completely free of conversions, which makes the flow of data clearer.

Issue

ADP-3272