Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] - Simplify plutus scripts serialisation #685

Open
carbolymer opened this issue Nov 20, 2024 · 1 comment
Open

[FR] - Simplify plutus scripts serialisation #685

carbolymer opened this issue Nov 20, 2024 · 1 comment
Assignees

Comments

@carbolymer
Copy link
Contributor

carbolymer commented Nov 20, 2024

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)
@carbolymer carbolymer self-assigned this Nov 20, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label Dec 21, 2024
@Jimbo4350 Jimbo4350 removed the Stale label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants