`someUTxO` does not actually update `envUsedSomeUTxOs` in `GYTxMonadNode`
Describe the bug
If we look at the current someUTxO implementation for GYTxMonadNode:
someUTxO lang = do
addrs <- ownAddresses
utxosToConsider <- availableUTxOs
case lang of
PlutusV2 ->
case someTxOutRef utxosToConsider of
Just (oref, _) -> return oref
Nothing -> throwError . GYQueryUTxOException $ GYNoUtxosAtAddress addrs
PlutusV1 ->
case find utxoTranslatableToV1 $ utxosToList utxosToConsider of
Just u -> return $ utxoRef u
Nothing -> throwError . GYQueryUTxOException $ GYNoUtxosAtAddress addrs -- TODO: Better error message here?
We notice that the returned UTxO isn't actually removed from envUsedSomeUTxO. This seems problematic since the point of envUsedSomeUTxO is to track previously yielded someUTxOs so they aren't returned repeatedly.
As it currently stands, the field envUsedSomeUTxO is actually useless.
Expected behavior
envUsedSomeUTxO should be updated accordingly.
Additional context
Has this always been like this? I thought it used to work.
Tangentially related but the framework should use availableUTxOs wherever possible to obtain own utxos, instead of querying the own addresses.
Also, someUTxO impl for GYTxMonadNode should really be replaced with the randomTxOutRef from GYUTxO
As it currently stands, the field envUsedSomeUTxO is actually useless.
That is true, I think it never served any meaningful purpose and was just there in case we wanted to give it some meaning.
We notice that the returned UTxO isn't actually removed from envUsedSomeUTxO. This seems problematic since the point of envUsedSomeUTxO is to track previously yielded someUTxOs so they aren't returned repeatedly.
I think you meant that it is not added to envUsedSomeUTxOs?