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

Further improvements to pretty-printing in cooked v2 #228

Merged
merged 17 commits into from
Jan 31, 2023

Conversation

florentc
Copy link
Member

@florentc florentc commented Jan 26, 2023

This PR aims at introducing the following improvements to pretty-printing in cooked v2:

  • Requiring redeemers to be pretty printable like datums are
  • Introducing our own PrettyCooked class to be able to override pretty printing of Plutus types that are used as datum or redeemers without being encapsulated in a newtype (e.g. TxOutRef as minting redeemer in Auction). Also, such a class provides options for pretty printing.
  • Decouple pretty-printing stuff from the Staged module in which they don't belong
  • Implement printing options
    • Hash length
    • Show/hide default tx options
    • Show/hide transaction ids
    • More options to implement later when we need them
  • Adapt documentation comments accordingly

@florentc florentc force-pushed the fc/v2-prettyprint-improvements branch 2 times, most recently from 06f8782 to 1b70021 Compare January 30, 2023 15:19
@florentc florentc force-pushed the fc/v2-prettyprint-improvements branch from 1b70021 to a788004 Compare January 30, 2023 15:59
@florentc florentc force-pushed the fc/v2-prettyprint-improvements branch 2 times, most recently from 43ea0df to 2e9145d Compare January 30, 2023 16:14
@florentc florentc force-pushed the fc/v2-prettyprint-improvements branch from 2e9145d to 289a4e3 Compare January 30, 2023 17:09
@florentc florentc marked this pull request as ready for review January 30, 2023 17:48
Copy link
Contributor

@0xd34df00d 0xd34df00d left a comment

Choose a reason for hiding this comment

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

It'd be ideal to somehow avoid explicit pcOpts in every function in testing, but I'm not sure it could be reasonably done so. Looks good!

@florentc
Copy link
Member Author

I agree it is not ideal but since we often define wrappers for the testing functions during audits (e.g. to include our custom initial distribution) I do not expect it to be a big hindrance in practice.

We also plan to modernize that module which is mostly legacy from V1 at this point (e.g. to print more information about how many traces have been evaluated). There are chances we will reconsider the API in the near future.

@florentc florentc force-pushed the fc/v2-prettyprint-improvements branch from e976fe3 to e0aa5a5 Compare January 30, 2023 22:56
@florentc florentc force-pushed the fc/v2-prettyprint-improvements branch from 4e0116b to 5f6909e Compare January 31, 2023 09:41
Copy link
Contributor

@carlhammann carlhammann left a comment

Choose a reason for hiding this comment

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

I like this!

cooked-validators/src/Cooked/Pretty.hs Show resolved Hide resolved
cooked-validators/src/Cooked/Pretty.hs Outdated Show resolved Hide resolved
cooked-validators/src/Cooked/Pretty.hs Outdated Show resolved Hide resolved
cooked-validators/src/Cooked/Pretty/Class.hs Show resolved Hide resolved
@florentc florentc merged commit 716de7e into ch/hedge-v2 Jan 31, 2023
@florentc florentc deleted the fc/v2-prettyprint-improvements branch January 31, 2023 17:25
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.

4 participants