Open sjoerdvisscher opened 1 year ago
Internal/External Internal
Area Other: cardano-api
Summary The equality of Value is derived:
Value
newtype Value = Value (Map AssetId Quantity) deriving Eq
But this breaks equality for entries with quantity 0.
The code tries to make sure these entries are not created, but this is hard to do. I found one example where this goes wrong:
lovelaceToValue :: Lovelace -> Value lovelaceToValue = Value . Map.singleton AdaAssetId . lovelaceToQuantity
I.e. lovelaceToValue 0 creates a Value with a zero quantity entry.
lovelaceToValue 0
Now it would be good to fix this too, but the safer fix is to write an Eq instance manually that allows for zero quantity entries.
Eq
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.
Internal/External Internal
Area Other: cardano-api
Summary The equality of
Value
is derived:But this breaks equality for entries with quantity 0.
The code tries to make sure these entries are not created, but this is hard to do. I found one example where this goes wrong:
I.e.
lovelaceToValue 0
creates aValue
with a zero quantity entry.Now it would be good to fix this too, but the safer fix is to write an
Eq
instance manually that allows for zero quantity entries.