Skip to content

Commit

Permalink
SCP-4566 Clarified relationship between redeemer and input in spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwbush committed Dec 2, 2022
1 parent 24b2067 commit a92b1d7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion marlowe/specification/marlowe-cardano-specification.md
Expand Up @@ -177,14 +177,23 @@ Furthermore, let `marloweValidatorHash :: ValidatorHash` be the hash of the Marl
The validation fails (via returning `False` for `validationResult` or via the throwing of an error) if any of the following constraints does not hold. Fundamentally, all failures in Plutus are calls to `error` and all successes are returns of `()`. The typed Plutus validators obscure this distinction slightly by using `Bool` as the return type.


#### *Constraint 0.* Input to contract

The input present in the redeemer and script context is the input provided to the semantics computation.
```haskell
marloweInput txInfoValidRange (scriptContextTxInfo scriptContext) txInfoData (scriptContextTxInfo scriptContext) transactionInput
```
This is a congruence because `marloweInput` contains the input (perhaps including the Merkle hash of the contract's continuation) and `txInfoValidRange` of the script context contains the validity interval for the transaction, whereas `transactionInput` contains both. Additionally, any continued contract is present in `txInfoData` of the script context, whereas it is directly present in any `MerkleizedInput` of `transactionInput`. Also note that the script context may, in principle, contain an open, closed, or half-open/half-closed time interval, but Marlowe semantics requires a closed time interval.


#### *Constraint 1.* Typed validation

The datum, redeemer, and script context deserialize to the correct types.

Let `datum :: BuiltinData` and `redeemer :: BuiltinData` be the datum and redeemer in the script witness for spending the Marlowe UTxO, and let `scriptContext' :: BuiltinData` be the script context data.
```haskell
fromBuiltinData datum (Just marloweData :: Maybe MarloweData)
fromBuiltinData redeemer (Just markloweInput :: Maybe MarloweInput)
fromBuiltinData redeemer (Just marloweInput :: Maybe MarloweInput)
fromBuiltinData scriptContext' (Just scriptContext :: Maybe ScriptContext)
```

Expand Down

0 comments on commit a92b1d7

Please sign in to comment.