UTxOW¶
Witnessing Functions¶
UsesBootstrapAddress : UTxO → Tx ℓ → Type UsesBootstrapAddress utxo tx = ∃[ o ∈ (range txOuts) ∪ range (utxo ∣ (txIns ∪ referenceInputs)) ] isBootstrapAddr (proj₁ o) where open Tx tx; open TxBody txBody module _ (tx : TopLevelTx) where open Tx tx open TxBody txBody module _ (utxo : UTxO) where HasInlineDatum : TxOut → Type HasInlineDatum txout = Is-just (txOutToDatum txout) UsesV2Features : Type UsesV2Features = ∃[ o ∈ (range txOuts) ∪ range (utxo ∣ (txIns ∪ referenceInputs)) ] HasInlineDatum o data UsesV3Features : Set where hasVotes : ¬ (Is-[] txGovVotes) → UsesV3Features hasProposals : ¬ (Is-[] txGovProposals) → UsesV3Features hasDonation : NonZero txDonation → UsesV3Features hasTreasure : Is-just currentTreasury → UsesV3Features data UsesV4Features : Set where hasSubtransactions : ¬ (Is-[] txSubTransactions) → UsesV4Features hasGuards : ¬ (Is-∅ txGuards) → UsesV4Features
languages : ℙ P2Script → ℙ Language languages p2Scripts = mapˢ language p2Scripts allowedLanguagesLegacyMode : TopLevelTx → UTxO → ℙ Language allowedLanguagesLegacyMode tx utxo = if UsesV3Features tx then fromList (PlutusV3 ∷ []) else if UsesV2Features tx utxo then fromList (PlutusV3 ∷ PlutusV2 ∷ []) else fromList (PlutusV3 ∷ PlutusV2 ∷ PlutusV1 ∷ [])
The SUBUTXOW Transition System¶
-
Sub-transactions cannot reference or use bootstrap addresses
-
All needed phase-2 scripts use Plutus language V4.
data _⊢_⇀⦇_,SUBUTXOW⦈_ : SubUTxOEnv → UTxOState → SubLevelTx → UTxOState → Type where SUBUTXOW : let open Tx txSub open TxBody txBody open TxWitnesses txWitnesses open UTxOEnv utxo₀ = UTxOOf Γ utxo = UTxOOf s vKeyHashesProvided : ℙ KeyHash vKeyHashesProvided = mapˢ hash (dom vKeySigs) scriptsProvided : ℙ Script scriptsProvided = ScriptPoolOf Γ dataProvided : ℙ Data dataProvided = range (DataPoolOf Γ) credentialsNeeded : ℙ Credential credentialsNeeded = mapˢ proj₂ (credsNeeded utxo₀ txSub) vKeyHashesNeeded : ℙ KeyHash vKeyHashesNeeded = mapPartial isKeyHashObj credentialsNeeded scriptHashesNeeded : ℙ ScriptHash scriptHashesNeeded = mapPartial isScriptObj credentialsNeeded scriptsNeeded : ℙ Script scriptsNeeded = filterˢ (λ s → hash s ∈ scriptHashesNeeded) scriptsProvided p1ScriptsNeeded : ℙ P1Script p1ScriptsNeeded = mapPartial toP1Script scriptsNeeded p2ScriptsNeeded : ℙ P2Script p2ScriptsNeeded = mapPartial toP2Script scriptsNeeded dataHashesNeeded : ℙ DataHash dataHashesNeeded = mapPartial (λ txOut@(a , _ , d , _) → do sh ← isScriptObj (payCred a) _ ← lookupHash sh p2ScriptsNeeded d >>= isInj₂) (range (utxo₀ ∣ txIns)) in ∙ ∀[ (vk , σ) ∈ vKeySigs ] isSigned vk (txidBytes txId) σ ∙ ∀[ s ∈ p1ScriptsNeeded ] validP1Script vKeyHashesProvided txVldt s ∙ vKeyHashesNeeded ⊆ vKeyHashesProvided ∙ scriptHashesNeeded ⊆ mapˢ hash scriptsProvided ∙ dataHashesNeeded ⊆ mapˢ hash dataProvided ∙ languages p2ScriptsNeeded ⊆ dom (PParams.costmdls (PParamsOf Γ)) ∩ ❴ PlutusV4 ❵ -- (1) ∙ txADhash ≡ map hash txAuxData ∙ Γ ⊢ s ⇀⦇ txSub ,SUBUTXO⦈ s' ──────────────────────────────── Γ ⊢ s ⇀⦇ txSub ,SUBUTXOW⦈ s'
The UTXOW Transition System¶
data _⊢_⇀⦇_,UTXOW⦈_ : UTxOEnv → UTxOState → TopLevelTx → UTxOState → Type where
In Dijkstra, the UTXOW transition system for the top-level transaction has two
different operating modes, normal mode and legacy mode. These correspond to the
rules UTXOW-normal and UTXOW-legacy.
Normal Mode¶
-
All needed phase-2 scripts use Plutus language V4.
-
If the top-level transaction uses or references bootstrap addresses then the set of needed phase-2 scripts must be empty.
-
The required top-level guards of subtransactions appear in the set of guards at the top-level.
UTXOW-normal : let open Tx txTop open TxBody txBody open TxWitnesses txWitnesses open UTxOEnv utxo₀ = Γ .utxo₀ utxo = s .UTxOState.utxo vKeyHashesProvided : ℙ KeyHash vKeyHashesProvided = mapˢ hash (dom vKeySigs) scriptsProvided : ℙ Script scriptsProvided = ScriptPoolOf Γ dataProvided : ℙ Data dataProvided = range (DataPoolOf Γ) credentialsNeeded : ℙ Credential credentialsNeeded = mapˢ proj₂ (credsNeeded utxo₀ txTop) vKeyHashesNeeded : ℙ KeyHash vKeyHashesNeeded = mapPartial isKeyHashObj credentialsNeeded scriptHashesNeeded : ℙ ScriptHash scriptHashesNeeded = mapPartial isScriptObj credentialsNeeded scriptsNeeded : ℙ Script scriptsNeeded = filterˢ (λ s → hash s ∈ scriptHashesNeeded) scriptsProvided p1ScriptsNeeded : ℙ P1Script p1ScriptsNeeded = mapPartial toP1Script scriptsNeeded p2ScriptsNeeded : ℙ P2Script p2ScriptsNeeded = mapPartial toP2Script scriptsNeeded dataHashesNeeded : ℙ DataHash dataHashesNeeded = mapPartial (λ txOut@(a , _ , d , _) → do sh ← isScriptObj (payCred a) _ ← lookupHash sh p2ScriptsNeeded d >>= isInj₂) (range (utxo₀ ∣ txIns)) in ∙ (UsesBootstrapAddress utxo₀ txTop → Is-∅ p2ScriptsNeeded) -- (2) ∙ RequiredGuardsInTopLevel txTop -- (3) ∙ ∀[ (vk , σ) ∈ vKeySigs ] isSigned vk (txidBytes txId) σ ∙ ∀[ s ∈ p1ScriptsNeeded ] validP1Script vKeyHashesProvided txVldt s ∙ vKeyHashesNeeded ⊆ vKeyHashesProvided ∙ scriptHashesNeeded ⊆ mapˢ hash scriptsProvided ∙ dataHashesNeeded ⊆ mapˢ hash dataProvided ∙ languages p2ScriptsNeeded ⊆ dom (PParams.costmdls (PParamsOf Γ)) ∩ ❴ PlutusV4 ❵ -- (1) ∙ txADhash ≡ map hash txAuxData ∙ (Γ , false) ⊢ s ⇀⦇ txTop ,UTXO⦈ s' ──────────────────────────────── Γ ⊢ s ⇀⦇ txTop ,UTXOW⦈ s'
Legacy mode¶
-
There is at least a needed phase-2 script with Plutus language version V1, V2 or V3.
-
The language of all needed phase-2 scripts is compatible with the features used by the top-level transaction, (votes, proposals, inline datum, ...) (See
allowedLanguagesLegacy). Moreover, all needed phase-2 scripts use Plutus language versions V1, V2, or V3. -
The top-level transaction does not use or reference bootstrap addresses (in case it does, it is handled in normal mode).
-
Guardsis the empty set, and, thus, all sub-transaction'srequiredTopLevelGuardsare also the empty set.
UTXOW-legacy : let open Tx txTop open TxBody txBody open TxWitnesses txWitnesses open UTxOEnv utxo₀ = UTxOOf Γ utxo = UTxOOf s vKeyHashesProvided : ℙ KeyHash vKeyHashesProvided = mapˢ hash (dom vKeySigs) scriptsProvided : ℙ Script scriptsProvided = witnessScripts txTop ∪ spendScripts txTop utxo₀ ∪ referenceScripts txTop utxo₀ dataProvided : ℙ Datum dataProvided = getTxData txTop utxo₀ credentialsNeeded : ℙ Credential credentialsNeeded = mapˢ proj₂ (credsNeeded utxo₀ txTop) vKeyHashesNeeded : ℙ KeyHash vKeyHashesNeeded = mapPartial isKeyHashObj credentialsNeeded scriptHashesNeeded : ℙ ScriptHash scriptHashesNeeded = mapPartial isScriptObj credentialsNeeded scriptsNeeded : ℙ Script scriptsNeeded = filterˢ (λ s → hash s ∈ scriptHashesNeeded) scriptsProvided p1ScriptsNeeded : ℙ P1Script p1ScriptsNeeded = mapPartial toP1Script scriptsNeeded p2ScriptsNeeded : ℙ P2Script p2ScriptsNeeded = mapPartial toP2Script scriptsNeeded dataHashesNeeded : ℙ DataHash dataHashesNeeded = mapPartial (λ txOut@(a , _ , d , _) → do sh ← isScriptObj (payCred a) _ ← lookupHash sh p2ScriptsNeeded d >>= isInj₂) (range (utxo₀ ∣ txIns)) in ∙ ∃[ s ∈ p2ScriptsNeeded ] language s ∈ fromList (PlutusV1 ∷ PlutusV2 ∷ PlutusV3 ∷ []) -- (1) ∙ ¬ (UsesBootstrapAddress utxo₀ txTop) -- (3) ∙ Is-∅ (GuardsOf txTop) -- (4) ∙ RequiredGuardsInTopLevel txTop -- (4) ∙ ∀[ (vk , σ) ∈ vKeySigs ] isSigned vk (txidBytes txId) σ ∙ ∀[ s ∈ p1ScriptsNeeded ] validP1Script vKeyHashesProvided txVldt s ∙ vKeyHashesNeeded ⊆ vKeyHashesProvided ∙ scriptHashesNeeded ⊆ mapˢ hash scriptsProvided ∙ dataHashesNeeded ⊆ mapˢ hash dataProvided ∙ languages p2ScriptsNeeded ⊆ dom (PParams.costmdls (PParamsOf Γ)) ∩ allowedLanguagesLegacyMode txTop utxo -- (2) ∙ txADhash ≡ map hash txAuxData ∙ (Γ , true) ⊢ s ⇀⦇ txTop ,UTXO⦈ s' ──────────────────────────────── Γ ⊢ s ⇀⦇ txTop ,UTXOW⦈ s'