Skip to content

PlutusV4 script construction not implemented in old API (Plutus/Internal/Script.hs:1302) #1188

@Jimbo4350

Description

@Jimbo4350

Problem

cardano-api/src/Cardano/Api/Plutus/Internal/Script.hs:1302 contains a placeholder error for PlutusV4 script construction in the old API:

toShelleyScript
  ( ScriptInEra
      _langInEra
      ( PlutusScript
          PlutusScriptV4
          (PlutusScriptSerialised _script)
        )
    ) = error "toShelleyScript: PlutusV4 not implemented yet."

The intended implementation exists as a commented-out block at lines 1304–1310:

-- TODO: Ledger needs to introduce a plutusV4 constructor
-- case langInEra of
--   PlutusScriptV4InConway ->
--     Alonzo.PlutusScript . Conway.ConwayPlutusV3 . Plutus.Plutus $ Plutus.PlutusBinary script
--   PlutusScriptV4InDijkstra ->
--     Alonzo.PlutusScript . Dijkstra.MkDijkstraPlutusScript . Conway.ConwayPlutusV3 . Plutus.Plutus $
--       Plutus.PlutusBinary script

Blocker

Ledger needs to expose a PlutusV4 script constructor on Dijkstra (Dijkstra.MkDijkstraPlutusScript / DijkstraPlutusV4) before this can be implemented in cardano-api.

Related

A structurally similar PlutusV4 stub exists at cardano-api/src/Cardano/Api/Experimental/Tx/Internal/AnyWitness.hs:128:

getPlutusDatum L.SPlutusV4 (SpendingScriptDatum _d) = error "TODO Dijkstra: getPlutusDatum: era not supported"

This one doesn't block on ledger — PlutusScriptDatumF L.PlutusV4 SpendingScript = Maybe HashableScriptData (CIP-69 style, matches V3), so the fix is likely a one-liner:

getPlutusDatum L.SPlutusV4 (SpendingScriptDatum d) = d

It is phrased as a Dijkstra placeholder (and unified under TODO Dijkstra: in #1187 for greppability) but it is really a PlutusV4 gap and can be fixed independently of ledger work.

Context

#1187 unified all Dijkstra-era placeholder messages in cardano-api under the single greppable token TODO Dijkstra:. This PlutusV4 stub was intentionally excluded because it blocks on ledger work rather than cardano-api work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions