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

Add PParamUpdates to the plutus context, by transforming them to Plutus Data #3999

Merged
merged 4 commits into from
Jan 24, 2024

Conversation

TimSheard
Copy link
Contributor

@TimSheard TimSheard commented Jan 18, 2024

Adds a new class ToPlutusData
Uses table driven approach to make instance for PParamsUpdate

resolves #3994

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

@TimSheard TimSheard force-pushed the ts-pparamUpdate-via-Data branch from 60d5784 to 749fa0a Compare January 18, 2024 23:43
@TimSheard TimSheard requested a review from lehins January 18, 2024 23:44
@TimSheard
Copy link
Contributor Author

Still a work in progress as it doesn't do anything yet with the plutus context

Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

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

There are some issues in the PR, but the overall direction is great!

The only thing that is missing now is the actual translation to PlutusV3 context and roundtrip tests that should have the reusable functionality placed in cardano-ledger-core:testlib:Test.Cardano.Ledger.Plutus.ToPlutusData
and the actual Conway tests should go into cardano-ledger-conway:tests:Test.Cardano.Ledger.Conway.Plutus.ToPlutusData

@TimSheard TimSheard force-pushed the ts-pparamUpdate-via-Data branch 5 times, most recently from d99889f to 1ea5e01 Compare January 22, 2024 16:40
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

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

This looks great. Semantically that is exactly what we need.
Just a few comments on shuffling things around for consistency with the rest of the codebase

eras/conway/impl/src/Cardano/Ledger/Conway/PParams.hs Outdated Show resolved Hide resolved
eras/conway/impl/src/Cardano/Ledger/Conway/PParams.hs Outdated Show resolved Hide resolved
eras/conway/impl/test/Main.hs Outdated Show resolved Hide resolved
eras/conway/impl/test/Main.hs Outdated Show resolved Hide resolved
eras/conway/impl/src/Cardano/Ledger/Conway.hs Outdated Show resolved Hide resolved
@TimSheard TimSheard force-pushed the ts-pparamUpdate-via-Data branch from d144ec8 to 7a4041a Compare January 24, 2024 00:59
@lehins lehins changed the title WIP add PParamUpdates to the plutus context, by transforming them to Plutus Data Add PParamUpdates to the plutus context, by transforming them to Plutus Data Jan 24, 2024
@lehins lehins force-pushed the ts-pparamUpdate-via-Data branch 3 times, most recently from 5ad5f34 to 356ae86 Compare January 24, 2024 11:48
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

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

@TimSheard There was a few things still needed to be rearranged in this PR, but because we will try to make a release today and this functionality is needed for the next release I took upon myself to finish this up. Check out the last few commits to see what I've done.

@lehins lehins enabled auto-merge January 24, 2024 11:50
@lehins lehins force-pushed the ts-pparamUpdate-via-Data branch from 356ae86 to 0296139 Compare January 24, 2024 13:17
TimSheard and others added 4 commits January 24, 2024 15:08
* Add `Cardano.Ledger.Core.Plutus.ToPlutusData`
* Add ToPlutusData class
* Add ToPlutusData instances in `Cardano.Ledger.Conway.PParams`
* Use table driven approach to make instance for PParamsUpdate
* Property tests added
* Add module `Cardano.Ledger.Conway.Plutus.Context`
* Add class `ToPlutusData (PParamsUpdate era) => ConwayEraPlutusTxInfo (l :: Language) era`
* Complete module `Cardano.Ledger.Conway.TxInfo` using `ConwayEraPlutusTxInfo` instance
This change is needed for consistency with how the rest of the
translation works and to avoid constructing unnecessary `Proxy`,
since `Plutus a` is already used as a proxy.
This is necessary to remove such instance for PlutusV1, PlutusV2 and the
future languages past PlutusV3.

Make `EraPlutusTxInfo` usperclass of `ConwayEraPlutusTxInfo` for
consistent hierarchy of classes
@lehins lehins force-pushed the ts-pparamUpdate-via-Data branch from 0296139 to 6901667 Compare January 24, 2024 14:08
@lehins lehins merged commit 5f76eb9 into master Jan 24, 2024
10 of 28 checks passed
Soupstraw pushed a commit that referenced this pull request Jan 25, 2024
Add PParamUpdates to the plutus context, by transforming them to Plutus Data
@neilmayhew neilmayhew deleted the ts-pparamUpdate-via-Data branch March 8, 2024 21:07
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.

PParamsUpdate translation to PlutusV3 context
2 participants