Closed zmrocze closed 5 months ago
I don't think there's a formally declared definition of .plutus
file that being said, type field can easily added if needed.
Besides, Ply scripts will almost never be used with Cardano cli because it needs to be applied with paratmeters. For CTL, I encourage using ply-ctl instead of applying parameters manually
yes, i know, but it seems like a low hanging fruit. For example it'd allow importing both with ply and with cardano-api.
IMO, I need to add function that writes .plutus
while ensuring there's no more parameters left to apply. I'm mainly concerned with people mistakenly use scripts that needs to be applied with parameters as regular policy or validator.
ply export, in a sense, is not really meant to be .plutus
, and they weren't meant to be used as ScriptEnevelope
directly.
the function I mentioned on top would look like:
writePlutusEnvelope :: FilePath -> TypedScript _ '[] -> IO ()
It makes explicit that only ready-to-go policies and validators can be exported to .plutus
I'll update the example export's filename as it can be misleading a bit
But what is the problem with saving partially-applied scripts?
It can be confusing. Possibly dangerous if cardano-cli
doesn't check given scripts(<- I'm not sure it it does or not)
I think this is crucial though, to be able to save partially-applied scripts? also the added type safety wouldn't add much, as - alright on the ply-based exporter side you're sure that a script is fully applied before saving it - but on the non-ply importer side it doesn't tell you anything
For me - this compatibility with cardano-api and the rest would make things much easier. I can also imagine that working out of the box with plenty of other tools is an advantage. Many like
The counter argument is that the "type" field is redundant as it follows from the "version" field.
If you guys agree to implement it, we could on scaffold budget (I can implement or you guys can).
https://github.com/mlabs-haskell/ply/pull/47
It's very simple. I guess it can be helpful, so why not.
Script
.plutus
files are expected to have this structure:and ply yields:
so ply expands on this providing more type information with additional fields. But the field "type" is missing, in the end making the envelope incompatible with
.plutus
still. Wouldn't it be good for the ply format to be a clean extension of.plutus
format, integrating withctl
/cardano-api
etc?