Skip to content

Commit

Permalink
Update the Certifying and Proposing script purposes (#5712)
Browse files Browse the repository at this point in the history
  • Loading branch information
zliu41 authored Jan 12, 2024
1 parent 607c501 commit ef18f58
Show file tree
Hide file tree
Showing 11 changed files with 873 additions and 1,016 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 383342775
| mem: 1182563})
({cpu: 366782775
| mem: 1110563})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 115203543
| mem: 358339})
({cpu: 112627543
| mem: 347139})
911 changes: 419 additions & 492 deletions plutus-benchmark/script-contexts/test/9.6/checkScriptContext1.pir.golden

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2807
2869
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 366878286
| mem: 1132120})
({cpu: 350318286
| mem: 1060120})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 110138686
| mem: 343128})
({cpu: 107562686
| mem: 331928})
931 changes: 425 additions & 506 deletions plutus-benchmark/script-contexts/test/9.6/checkScriptContext2.pir.golden

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2747
2809
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 304326100
| mem: 1215568})
({cpu: 304395100
| mem: 1215868})
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

### Changed

- Updated the `Certifying` and `Proposing` script purposes, whose arguments now consist of
both an integer index and the actual argument (`TxCert` and `ProposalProcedure`).
18 changes: 12 additions & 6 deletions plutus-ledger-api/src/PlutusLedgerApi/V3/Contexts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,15 @@ data ScriptPurpose
= Minting V2.CurrencySymbol
| Spending V2.TxOutRef
| Rewarding V2.Credential
| Certifying TxCert
| Certifying
Haskell.Integer
-- ^ 0-based index of the given `TxCert` in `txInfoTxCerts`
TxCert
| Voting Voter
| Proposing Haskell.Integer
| Proposing
Haskell.Integer
-- ^ 0-based index of the given `ProposalProcedure` in `txInfoProposalProcedures`
ProposalProcedure
deriving stock (Generic, Haskell.Show, Haskell.Eq)
deriving (Pretty) via (PrettyShow ScriptPurpose)

Expand All @@ -337,12 +343,12 @@ instance PlutusTx.Eq ScriptPurpose where
a PlutusTx.== a'
Rewarding a == Rewarding a' =
a PlutusTx.== a'
Certifying a == Certifying a' =
a PlutusTx.== a'
Certifying a b == Certifying a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'
Voting a == Voting a' =
a PlutusTx.== a'
Proposing a == Proposing a' =
a PlutusTx.== a'
Proposing a b == Proposing a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'
_ == _ = Haskell.False

-- | TxInfo for PlutusV3
Expand Down

0 comments on commit ef18f58

Please sign in to comment.