Skip to content

[BUG] - Remove plutus scripts double serialisation #685

@carbolymer

Description

@carbolymer

Internal/External
Internal if an IOHK staff member.

Area
Other Any other topic (Delegation, Ranking, ...).

Describe the feature you'd like
Currently Plutus Script lang serialisation uses double CBOR encoding. It serialises PlutusScript lang:

serialiseToCBOR (PlutusScript PlutusScriptV1 s) =

which stores already serialised script representation in CBOR. As a result, the TextEnvelope JSON produced contains cborHex which is doubly serialised.

This also makes decoding of Plutus scripts a two-stage process:

envelope <-
H.leftFailM $
fmap (deserialiseFromJSON AsTextEnvelope) . H.evalIO $
B.readFile "test/cardano-api-test/files/input/plutus/v3.alwaysTrue.json"
ScriptInAnyLang (PlutusScriptLanguage PlutusScriptV3) s@(PlutusScript PlutusScriptV3 script) <-
H.leftFail $ deserialiseFromTextEnvelopeAnyOf textEnvTypes envelope
let scriptLangInEra = case ceo of
ConwayEraOnwardsConway -> PlutusScriptV3InConway

Firstly the envelope has to be decoded from JSON, and then the PlutusScript itself.

Acceptance criteria:

  1. The plutus scripts are singly encoded when writing
  2. The single encoded plutus script can be read by cardano-api
  3. The double-encoded plutus script can be read by cardano-api (a fallback when logic in AC2 fails)

Metadata

Metadata

Assignees

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