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 witness and redeemer to view #861

Merged
merged 11 commits into from
Aug 21, 2024
Merged

Conversation

palas
Copy link
Contributor

@palas palas commented Aug 6, 2024

Changelog

- description: |
    Modify `transaction view` to show what inputs redeemers refer to.
# uncomment types applicable to the change:
  type:
  - feature        # introduces a new feature

Context

#664 added redeemers to the output of cardano-cli transaction view but it is difficult to know which one corresponds to which when there are several. This PR addresses this by showing this information paired with each redeemer.

How to trust this PR

Ensure that the new structure makes sense, that it looks good in the updated tests. And I am not so confident about how what the indexes correspond to, so probably verify that

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@palas palas added the enhancement New feature or request label Aug 6, 2024
@palas palas self-assigned this Aug 6, 2024
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

We want to keep this generic. We should not be pattern matching on era specific constructors. We want the redeemer map: Map (PlutusPurpose AsIx era) (Data era, ExUnits) which can be accessed from the ledger's Tx via a lens (or series of lenses).

Then use:

  redeemerPointerInverse ::
    TxBody era ->
    PlutusPurpose AsIx era ->
    StrictMaybe (PlutusPurpose AsIxItem era)

and class methods like toSpendingPurpose to get the actual thing the plutus script is witnessing.

@palas palas force-pushed the add-witness-and-redeemer-to-view branch from ae9ec8f to dfcade3 Compare August 8, 2024 19:23
@palas palas requested a review from Jimbo4350 August 8, 2024 19:23
@palas palas force-pushed the add-witness-and-redeemer-to-view branch from 4b12878 to b42ad1d Compare August 20, 2024 23:07
@palas palas requested a review from Jimbo4350 August 20, 2024 23:12
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

LGTM, I left a couple of comments. I would say definitely factor out the rendering of AsIxItem.

@palas palas added this pull request to the merge queue Aug 21, 2024
Merged via the queue into main with commit e3aa173 Aug 21, 2024
25 checks passed
@palas palas deleted the add-witness-and-redeemer-to-view branch August 21, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants