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

[BUG] - Remove plutus scripts double serialisation #685

Closed
carbolymer opened this issue Nov 20, 2024 · 1 comment · Fixed by #720
Closed

[BUG] - Remove plutus scripts double serialisation #685

carbolymer opened this issue Nov 20, 2024 · 1 comment · Fixed by #720
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
@carbolymer carbolymer assigned Jimbo4350 and unassigned carbolymer Jan 7, 2025
@carbolymer carbolymer linked a pull request Jan 10, 2025 that will close this issue
3 tasks
@Jimbo4350 Jimbo4350 changed the title [FR] - Simplify plutus scripts serialisation [BUG] - Simplify plutus scripts serialisation Jan 15, 2025
@Jimbo4350 Jimbo4350 changed the title [BUG] - Simplify plutus scripts serialisation [BUG] - Remove plutus scripts double serialisation Jan 15, 2025
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

Successfully merging a pull request may close this issue.

2 participants