Skip to content

Commit

Permalink
remove the unused collectNNScriptInputs
Browse files Browse the repository at this point in the history
The function was replaced by collectTwoPhaseScriptInputs a while ago,
 but the old function was never removed.
  • Loading branch information
Jared Corduan committed May 5, 2021
1 parent 657f936 commit 485d7e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
29 changes: 1 addition & 28 deletions alonzo/impl/src/Cardano/Ledger/Alonzo/PlutusScriptApi.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
module Cardano.Ledger.Alonzo.PlutusScriptApi
( -- Figure 8
getData,
collectNNScriptInputs,
evalScripts,
-- Figure 12
scriptsNeeded,
Expand Down Expand Up @@ -48,7 +47,7 @@ import Cardano.Ledger.ShelleyMA.Timelocks (evalTimelock)
import Data.Coders
import Data.List (foldl')
import qualified Data.Map as Map
import Data.Maybe (isJust, maybeToList)
import Data.Maybe (isJust)
import Data.Sequence.Strict (StrictSeq)
import Data.Set (Set)
import qualified Data.Set as Set
Expand Down Expand Up @@ -101,32 +100,6 @@ getData tx (UTxO m) sp = case sp of
Nothing -> []
Just d -> [d]

-- | Collect the inputs (Data, execution budget, costModel) for all twoPhase scripts.
collectNNScriptInputs ::
( Era era,
Core.Script era ~ AlonzoScript.Script era,
Core.TxOut era ~ Alonzo.TxOut era,
Core.TxBody era ~ Alonzo.TxBody era,
Core.Value era ~ Mary.Value (Crypto era),
HasField "datahash" (Core.TxOut era) (StrictMaybe (DataHash (Crypto era))),
HasField "_costmdls" (Core.PParams era) (Map.Map Language CostModel),
HasField "wdrls" (Core.TxBody era) (Wdrl (Crypto era)),
HasField "certs" (Core.TxBody era) (StrictSeq (DCert (Crypto era))),
HasField "inputs" (Core.TxBody era) (Set (TxIn (Crypto era)))
) =>
Core.PParams era ->
ValidatedTx era ->
UTxO era ->
[(AlonzoScript.Script era, [Data era], ExUnits, CostModel)]
collectNNScriptInputs pp tx utxo =
let txinfo = transTx utxo tx
in [ (script, d : (valContext txinfo sp : getData tx utxo sp), eu, cost)
| (sp, scripthash) <- scriptsNeeded utxo tx, -- TODO, IN specification ORDER IS WRONG
(d, eu) <- maybeToList (indexedRdmrs tx sp),
script <- maybeToList (Map.lookup scripthash (txscripts' (getField @"wits" tx))),
cost <- maybeToList (Map.lookup PlutusV1 (getField @"_costmdls" pp))
]

-- ========================================================================

-- | When collecting inputs for twophase scripts, 3 things can go wrong.
Expand Down
1 change: 1 addition & 0 deletions alonzo/test/cardano-ledger-alonzo-test.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ test-suite cardano-ledger-alonzo-test
other-modules:
Test.Cardano.Ledger.Alonzo.Golden
Test.Cardano.Ledger.Alonzo.Serialisation.Tripping
Test.Cardano.Ledger.Alonzo.Examples.Bbody
Test.Cardano.Ledger.Alonzo.Examples.Utxow
Test.Cardano.Ledger.Alonzo.Translation
Test.Cardano.Ledger.Alonzo.Serialisation.CDDL
Expand Down

0 comments on commit 485d7e5

Please sign in to comment.