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

CIP-0069 | add Datum to ScriptContext #784

Merged
merged 9 commits into from
Jun 6, 2024
25 changes: 21 additions & 4 deletions CIP-0069/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,29 @@ This primarily manifests in the ability to use a single validator for both minti
All the script purposes have a form of `Redeemer -> ScriptContext -> a` except the `Spending` one.
It has the following form: `Datum -> Redeemer -> ScriptContext -> a`. This is enforced by the Cardano ledger.

We modify the general signature to be `ScriptArgs -> ScriptContext -> a`.
We make the following modification:

- The signature of all scripts will be `Redeemer -> ScriptContext -> a`.
- The `ScriptPurpose` type is modified such that the `Spending` variant contains a `Datum`:

```hs
data ScriptPurpose
= ...
| Spending TxOutRef Datum
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be Maybe Datum instead of Datum? Or is this a Datum field containing
Datum Hash, InlineDatum, No Datum?

...
```

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest we also specify somewhere here maybe that we need enforce a single argumet to plutus evaluating function, which at the very least means changing type signatures for these two functions for PlutusV3 in a way that they will accept a single PLC.Data agument, instead of [PLC.Data]:

- A new data type `ScriptIdentifier` is created.
It is identical to the original `ScriptPurpose` and is used in the `txInfoRedeemers` map to uniquely identify a script within a transaction.

```hs
data ScriptArgs =
RedeemerOnly Redeemer
| RedeemerAndDatum Redeemer Datum
data ScriptIdentifier
= MintingScript CurrencySymbol
| SpendingScript TxOutRef
| RewardingScript Credential
| CertifyingScript Integer TxCert
| VotingScript Voter
| ProposingScript Integer ProposalProcedure
```

## Rationale: how does this CIP achieve its goals?
Expand Down