Skip to content

Commit

Permalink
Maybe fix toLedgerTx in presence of aux data changes
Browse files Browse the repository at this point in the history
We suspect that toLedgerTx is incomplete if the cardano-api Tx was
modified in it's auxiliary data.
  • Loading branch information
ch1bo committed May 8, 2024
1 parent 226edac commit e20a5cf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hydra-cardano-api/src/Hydra/Cardano/Api/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import Cardano.Ledger.Api (
datsTxWitsL,
feeTxBodyL,
hashScriptTxWitsL,
hashTxAuxData,
inputsTxBodyL,
isValidTxL,
mintTxBodyL,
Expand All @@ -56,7 +57,7 @@ import Cardano.Ledger.Api qualified as Ledger
import Cardano.Ledger.Babbage qualified as Ledger
import Cardano.Ledger.Babbage.Tx qualified as Ledger
import Cardano.Ledger.Babbage.TxWits (upgradeTxDats)
import Cardano.Ledger.BaseTypes (maybeToStrictMaybe, strictMaybeToMaybe)
import Cardano.Ledger.BaseTypes (StrictMaybe (..), maybeToStrictMaybe, strictMaybeToMaybe)
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Conway.Scripts (PlutusScript (..))
import Cardano.Ledger.Conway.Scripts qualified as Conway
Expand Down Expand Up @@ -225,7 +226,9 @@ toLedgerTx = \case
& hashScriptTxWitsL .~ scripts
& datsTxWitsL .~ datums
& rdmrsTxWitsL .~ redeemers
in mkBasicTx body
in mkBasicTx
-- TODO: Test that aux data hash is correctly updated in conversions
(body & auxDataHashTxBodyL .~ maybe SNothing (SJust . hashTxAuxData) auxData)
& isValidTxL .~ toLedgerScriptValidity validity
& auxDataTxL .~ maybeToStrictMaybe auxData
& witsTxL .~ wits
Expand Down

0 comments on commit e20a5cf

Please sign in to comment.