Split script datum types to prepare for uninhabitable NoScriptDatum#1348
Draft
Split script datum types to prepare for uninhabitable NoScriptDatum#1348
Conversation
…NoScriptDatum Split both types into spending and non-spending constructors, pinning the spending constructors to Exp.TxInItem. This removes the OptionalDatum type family and all uses of NoScriptDatumAllowed in preparation for making NoScriptDatum uninhabitable in cardano-api.
…ed ADTs Replace the polymorphic `ScriptRequirements witnessable` GADT (and its inner types `OnDiskPlutusScriptCliArgs`, `PlutusRefScriptCliArgs`, `SimpleRefScriptCliArgs`, `MintPolicyId`, `NoPolicyId`) with flat, context-specific ADTs: - `SimpleScriptRequirements` (on-disk or reference, no datum/redeemer) - `PlutusSpendingScriptRequirements` (with datum support for CIP-69) - `PlutusMintingScriptRequirements` (includes PolicyId for reference scripts) - `PlutusNonAssetScriptRequirements` (cert/withdrawal/vote/proposal) Command-level sum types replace `ScriptRequirements witnessable` in records: - `AnySpendScript` (for TxIn spending witnesses) - `AnyMintScript` (for minting witnesses, 3 constructors to encode the PolicyId invariant exhaustively) - `AnyNonAssetScript` (for cert/withdrawal/vote/proposal witnesses) All pattern matches are now exhaustive. The `error "impossible"` branches in Spend/Read.hs are eliminated. The golden test CLI interface is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OnDiskPlutusScriptCliArgsintoOnDiskPlutusScriptCliArgsSpending(pinned toTxInItem, carriesScriptDatumOrFileSpending) andOnDiskPlutusScriptCliArgsNonSpending(no datum field)PlutusRefScriptCliArgsintoPlutusRefScriptCliArgsSpending(pinned toTxInItem, carries datum) andPlutusRefScriptCliArgsNonSpending(no datum, retainsMintPolicyId witnessable)OptionalDatumtype family and all uses ofNoScriptDatumAllowedCloses #1082
Notes
The non-spending constructors are still polymorphic in
witnessable, meaning GHC cannot statically rule them out in a spending context. Twoerror "impossible"branches are added inSpend/Read.hsas a temporary measure — this will be revisited when the type structure is tightened further.The remaining
Exp.NoScriptDatumusages in thePlutusScriptWitnessconstructions in the Read files are intentionally left — these will be addressed when the cardano-api side of #1082 lands.