You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 2, 2024. It is now read-only.
I try to test my contracts with functions toCardanoTxBody and evaulateTransactionExecutionUnits.
I build Plutus Tx by hand and convert it to cardano Tx to use evaluation function.
Something strange happens when I update datum from the input to output on the same address.
It can not find datum by datum hash. The function that I use to create part of Tx that pays to script:
--| Pay to the script.payToScript::ToData (DatumTypea) =>TypedValidatora->DatumTypea->Value->Tx
payToScript tv dat val =mempty
{ txOutputs = [TxOut (validatorAddress tv) val (Just dh)]
, txData =M.singleton dh datum
}
where
dh = datumHash datum
datum =Datum$ toBuiltinData dat
So it seems that I fill up txData and set up datum hash properly.
But when I use it in the code datum can only be found if it is the same as used in the inputs. If I change the datum validator can not find it in the outputs of TxInfo by hash although datum hash is present.
I tried to lookup how the function toCardanoTxBody works and I can see that it does not use txData.
Or maybe I miss something?
Please can you explain how txData should be used in the Cardano TxBody properly so that I can continue with my testing?
or how it should be used in toCardanoTxBody?
As I understand Cardano Tx does not contain datum's and only hashes are used.
How can the datums be visible to evaluateTransactionExecutionUnits?
I've tried to include also output datums in the UTxO argument of evaluateTransactionExecutionUnits and it also can not find them :(
Summary
I try to test my contracts with functions
toCardanoTxBodyandevaulateTransactionExecutionUnits.I build Plutus
Txby hand and convert it to cardanoTxto use evaluation function.Something strange happens when I update datum from the input to output on the same address.
It can not find datum by datum hash. The function that I use to create part of Tx that pays to script:
So it seems that I fill up
txDataand set up datum hash properly.But when I use it in the code datum can only be found if it is the same as used in the inputs. If I change the datum validator can not find it in the outputs of TxInfo by hash although datum hash is present.
I tried to lookup how the function
toCardanoTxBodyworks and I can see that it does not usetxData.Or maybe I miss something?
Please can you explain how
txDatashould be used in the CardanoTxBodyproperly so that I can continue with my testing?or how it should be used in
toCardanoTxBody?As I understand Cardano Tx does not contain datum's and only hashes are used.
How can the datums be visible to
evaluateTransactionExecutionUnits?I've tried to include also output datums in the
UTxOargument ofevaluateTransactionExecutionUnitsand it also can not find them :(