Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Alexey Kuleshevich <alexey.kuleshevich@iohk.io>
  • Loading branch information
Jared Corduan and lehins committed Mar 31, 2023
1 parent 2087c79 commit bfbd4bb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
11 changes: 4 additions & 7 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/PParams.hs
Expand Up @@ -685,14 +685,11 @@ getLanguageView pp lang =
(serialize' version (serialize' version lang))
(serialize' version costModelEncoding)
PlutusV2 ->
LangDepView
(serialize' version lang)
costModelEncoding
PlutusV3 ->
LangDepView
(serialize' version lang)
costModelEncoding
latestLangDepView
PlutusV3 -> latestLangDepView
where
-- LangDepView for PlutusV1 differs from the rest
latestLangDepView = LangDepView (serialize' version lang) costModelEncoding
costModel = Map.lookup lang (costModelsValid $ pp ^. ppCostModelsL)
costModelEncoding = serialize' version $ maybe encodeNull encodeCostModel costModel
version = BT.pvMajor $ pp ^. ppProtocolVersionL
Expand Down
4 changes: 3 additions & 1 deletion eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxAuxData.hs
Expand Up @@ -220,7 +220,9 @@ instance Era era => DecCBOR (Annotator (AlonzoTxAuxDataRaw era)) where
(D (sequence <$> decodeStrictSeq decCBOR))
auxDataField 2 = fieldA (addPlutusScripts PlutusV1) From
auxDataField 3 = fieldA (addPlutusScripts PlutusV2) From
auxDataField 4 = fieldA (addPlutusScripts PlutusV3) From
auxDataField 4 =
fieldA (addPlutusScripts PlutusV3) $
D (unlessDecoderVersionAtLeast (natVersion @9) (fail "PlutusV3 is not supported yet") >> decCBOR)
auxDataField n = field (\_ t -> t) (Invalid n)

emptyAuxData :: AlonzoTxAuxDataRaw era
Expand Down
8 changes: 3 additions & 5 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/TxInfo.hs
Expand Up @@ -187,7 +187,6 @@ babbageTxInfoV1 ::
( EraTx era
, BabbageEraTxBody era
, Value era ~ MaryValue (EraCrypto era)
, TxWits era ~ AlonzoTxWits era
) =>
PV1.POSIXTimeRange ->
Tx era ->
Expand Down Expand Up @@ -222,14 +221,13 @@ babbageTxInfoV1 timeRange tx utxo = do
outs = txBody ^. outputsTxBodyL
fee = txBody ^. feeTxBodyL
multiAsset = txBody ^. mintTxBodyL
datpairs = Map.toList (unTxDats $ txdats' witnesses)
datpairs = Map.toList (unTxDats $ witnesses ^. datsTxWitsL)

babbageTxInfoV2 ::
forall era.
( EraTx era
, BabbageEraTxBody era
, Value era ~ MaryValue (EraCrypto era)
, TxWits era ~ AlonzoTxWits era
) =>
PV2.POSIXTimeRange ->
Tx era ->
Expand Down Expand Up @@ -266,5 +264,5 @@ babbageTxInfoV2 timeRange tx utxo = do
outs = txBody ^. outputsTxBodyL
fee = txBody ^. feeTxBodyL
multiAsset = txBody ^. mintTxBodyL
datpairs = Map.toList (unTxDats $ txdats' witnesses)
rdmrs = Map.toList (unRedeemers $ txrdmrs' witnesses)
datpairs = Map.toList (unTxDats $ witnesses ^. datsTxWitsL)
rdmrs = Map.toList (unRedeemers $ witnesses ^. rdmrsTxWitsL)
Expand Up @@ -134,10 +134,10 @@ txb ::
TxBody era
txb i mRefInp o =
mkBasicTxBody
& inputsTxBodyL .~ (Set.singleton i)
& B.referenceInputsTxBodyL .~ (maybe mempty Set.singleton mRefInp)
& outputsTxBodyL .~ (StrictSeq.singleton o)
& feeTxBodyL .~ (Coin 2)
& inputsTxBodyL .~ Set.singleton i
& B.referenceInputsTxBodyL .~ maybe mempty Set.singleton mRefInp
& outputsTxBodyL .~ StrictSeq.singleton o
& feeTxBodyL .~ Coin 2

txBare ::
forall era.
Expand Down
6 changes: 2 additions & 4 deletions eras/conway/impl/src/Cardano/Ledger/Conway/TxInfo.hs
Expand Up @@ -43,7 +43,6 @@ conwayTxInfo ::
( EraTx era
, BabbageEraTxBody era
, Value era ~ MaryValue (EraCrypto era)
, TxWits era ~ AlonzoTxWits era
) =>
PParams era ->
Language ->
Expand All @@ -66,7 +65,6 @@ conwayTxInfoV3 ::
( EraTx era
, BabbageEraTxBody era
, Value era ~ MaryValue (EraCrypto era)
, TxWits era ~ AlonzoTxWits era
) =>
PV3.POSIXTimeRange ->
Tx era ->
Expand Down Expand Up @@ -103,5 +101,5 @@ conwayTxInfoV3 timeRange tx utxo = do
outs = txBody ^. outputsTxBodyL
fee = txBody ^. feeTxBodyL
multiAsset = txBody ^. mintTxBodyL
datpairs = Map.toList (unTxDats $ txdats' witnesses)
rdmrs = Map.toList (unRedeemers $ txrdmrs' witnesses)
datpairs = Map.toList (unTxDats $ witnesses ^. datsTxWitsL)
rdmrs = Map.toList (unRedeemers $ witnesses ^. rdmrsTxWitsL)

0 comments on commit bfbd4bb

Please sign in to comment.