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

Plutus type improvement #3531

Merged
merged 2 commits into from
Jul 18, 2023
Merged

Plutus type improvement #3531

merged 2 commits into from
Jul 18, 2023

Conversation

lehins
Copy link
Contributor

@lehins lehins commented Jul 17, 2023

Description

This PR does not change any Plutus semantics for all eras except Conway. It brings some type safety to Plutus ledger types and cleans up the code a bit.

For Conway it prepares the code to make it clearer a bit, but only after we are in Conway (see the added comment in the code)

Major parts of this PR are:

  • Adding Plutus data type and changing PlutusScript !Language !ShortByteString to PlutusScript !Plutus
  • Adding PlutusWithContext to avoid gross usage of four tuples and reduce number of arguments to a few functions

Most of the changes where done with deprecation in mind.

See changelogs or individual commits for more info

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages. New section is never added with the code changes. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

@lehins lehins force-pushed the lehins/plutus-type-improvement branch from 76c5845 to 4d66567 Compare July 17, 2023 23:16
@lehins lehins marked this pull request as ready for review July 17, 2023 23:21
Copy link
Contributor

@teodanciu teodanciu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Much easier to understand what's going on in PlutusScriptApi with the parameters grouped like this 👍

* Change type of `Plutus` to use `BinaryPlutus` instead of `ShortByteString`
* Deprecate `runPLCScript` in favor of `runPlutusScript`
* Addition of `PlutusWithContext`
* Deprecation of `collectTwoPhaseScriptInputs` in favor of `collectPlutusScriptsWithContext`
* Deprecation of `evalScripts` in favor of `evalPlutusScripts`
* Deprecation of `runPLCScript` in favor of `runPlutusScript`
* Deprecation of `explainPlutusFailure` in favor of `explainPlutusEvaluationError`
* Move `BinaryPlutus` into `cardano-ledger-core` package in `Cardano.Ledger.Language` module
* Change `PlutusScript` constructor of the `AlonzoScript` type. It now accepts the new
  `Plutus` type instead of a `Language` and `ShortByteString`
* Rename `pdSBS` field to `pdPlutusScript` in the `PlutusDebugLang` data type
* Added `withSLanguage`
* Move `BinaryPlutus` from `cardano-ledger-alonzo` and changed its `Show` instance to
  display as base64 encoding.
* Added `Plutus`
* Changed `Phase2Script` constructor of the `PhaseScript` type. It now accepts new
  `Plutus` type instead of `Language` and `ShortByteString`
@lehins lehins force-pushed the lehins/plutus-type-improvement branch from 4d66567 to 7f148c5 Compare July 18, 2023 16:36
@lehins lehins enabled auto-merge July 18, 2023 16:39
@lehins lehins merged commit 0e132bb into master Jul 18, 2023
11 of 12 checks passed
@iohk-bors iohk-bors bot deleted the lehins/plutus-type-improvement branch July 18, 2023 18:10
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 this pull request may close these issues.

None yet

2 participants