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

PLT-45: plutus-tx-constraints #490

Merged
merged 15 commits into from
Jun 6, 2022
Merged

Conversation

sjoerdvisscher
Copy link
Contributor

@sjoerdvisscher sjoerdvisscher commented May 31, 2022

This result is maybe not what was expected, at least it's not what I expected when I started. But after realising that the UnbalancedTx datatype needs to be reused, because it is expected by downstream code, and that the on-chain part is completely unaffected by the move to the cardano-api transaction type, I chose to only rewrite the OffChain module and re-export the TxConstraints and OnChain modules from plutus-ledger-constraints.

Also I initially thought that users would specify the constraints using cardano-api types for datums, values, hashes etc, but they should remain those from plutus since that's what scripts also receive from the script context.

Pre-submit checklist:

  • Branch
    • Tests are provided (if possible)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
    • Relevant tickets are mentioned in commit messages
    • Formatting, materialized Nix files, PNG optimization, etc. are updated
  • PR
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested

@sjoerdvisscher sjoerdvisscher requested review from koslambrou and a user June 1, 2022 11:46
Copy link

@ghost ghost 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 👍

@@ -333,6 +351,7 @@ initialState = ConstraintProcessingState
, cpsMintRedeemers = mempty
, cpsValueSpentBalancesInputs = ValueSpentBalances mempty mempty
, cpsValueSpentBalancesOutputs = ValueSpentBalances mempty mempty
, cpsParams = def
Copy link

Choose a reason for hiding this comment

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

Shouldn't we pass it directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not used here. It is passed directly in plutus-tx-constraints, where it is actually used. I'll add a comment.

@sjoerdvisscher sjoerdvisscher merged commit 7cc0603 into main Jun 6, 2022
@sjoerdvisscher sjoerdvisscher deleted the PLT-45-plutus-tx-constraints branch June 6, 2022 14:57
koslambrou pushed a commit that referenced this pull request Jun 22, 2022
* Clone plutus-ledger-constraints

* Implement withIsCardanoEra

* Support cardano-api Tx's in UnbalancedTx.

* Reuse code from pluts-ledger-constraints by importing it

* Implement MustPayToPubKeyAddress

* A new use of withIsCardanoEra

* Fix typo

* Fix unbalanced tx export

* Generate purs

* Fix UnbalancedTx pretty printing

* Make CardanoBuildTx a newtype

So we can compile it to RawJson in PureScript

* Clean up

* PR feedback
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.

2 participants