Skip to content

Commit 201cabc

Browse files
committed
Move alonzo era onwards check outside of calculatePlutusScriptCosts
1 parent ecbb740 commit 201cabc

File tree

1 file changed

+20
-14
lines changed
  • cardano-cli/src/Cardano/CLI/EraBased/Transaction

1 file changed

+20
-14
lines changed

cardano-cli/src/Cardano/CLI/EraBased/Transaction/Run.hs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,29 +1715,35 @@ runTransactionCalculatePlutusScriptCostCmd
17151715
EraMismatch{ledgerEraName = docToText $ pretty nodeEra, otherEraName = docToText $ pretty txEra}
17161716
)
17171717

1718-
calculatePlutusScriptsCosts
1719-
(convert txEra)
1720-
systemStart
1721-
eraHistory
1722-
pparams
1723-
txEraUtxo
1724-
tx
1718+
caseByronOrShelleyBasedEra
1719+
(left $ TxCmdAlonzoEraOnwardsRequired nodeEra)
1720+
( caseShelleyToMaryOrAlonzoEraOnwards
1721+
(\_ -> left $ TxCmdAlonzoEraOnwardsRequired nodeEra)
1722+
( \aeo ->
1723+
calculatePlutusScriptsCosts
1724+
aeo
1725+
systemStart
1726+
eraHistory
1727+
pparams
1728+
txEraUtxo
1729+
tx
1730+
)
1731+
)
1732+
nodeEra
17251733
where
17261734
calculatePlutusScriptsCosts
17271735
:: forall era
1728-
. CardanoEra era
1736+
. AlonzoEraOnwards era
17291737
-> SystemStart
17301738
-> EraHistory
17311739
-> LedgerProtocolParameters era
17321740
-> UTxO era
17331741
-> Tx era
17341742
-> ExceptT TxCmdError IO ()
1735-
calculatePlutusScriptsCosts era' systemStart eraHistory pparams txEraUtxo tx = do
1736-
scriptHashes <-
1737-
monoidForEraInEon @AlonzoEraOnwards
1738-
era'
1739-
(\aeo -> pure $ collectPlutusScriptHashes aeo tx txEraUtxo)
1740-
& hoistMaybe (TxCmdAlonzoEraOnwardsRequired era')
1743+
calculatePlutusScriptsCosts aeo systemStart eraHistory pparams txEraUtxo tx = do
1744+
let era' :: CardanoEra era = toCardanoEra aeo
1745+
1746+
let scriptHashes = collectPlutusScriptHashes aeo tx txEraUtxo
17411747

17421748
executionUnitPrices <-
17431749
pure (getExecutionUnitPrices era' pparams) & onNothing (left TxCmdPParamExecutionUnitsNotAvailable)

0 commit comments

Comments
 (0)