Skip to content

Commit f2f9003

Browse files
carlostomewilliamdemeo
authored andcommitted
Add preliminary check that txIns exist in the UTxO prior to any changes
1 parent af6d347 commit f2f9003

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/Ledger/Dijkstra/Specification/Utxo.lagda.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ record UTxOEnv : Type where
4141
slot : Slot
4242
pparams : PParams
4343
treasury : Treasury
44+
utxo₀ : UTxO
4445
4546
record UTxOState : Type where
4647
field
@@ -83,11 +84,13 @@ data _⊢_⇀⦇_,UTXOS⦈_ : UTxOEnv → UTxOState → TopLevelTx → UTxOState
8384
Γ ⊢ s ⇀⦇ tx ,UTXOS⦈ s
8485
```
8586

86-
## UTXO
87+
## The <span class="AgdaDatatype">UTXO</span> Transition System {#sec:the-utxo-transition-system}
8788

88-
(skeleton with the new phase-1 check)
89+
### New in Dijkstra
90+
91+
1. The set of spending inputs must exist in the UTxO _before_ applying the
92+
transaction (or partially applying any part of it). TODO: Add link to CIP once its finalized.
8993

90-
This is the intended home of Dijkstra "phase-1 structural checks."
9194

9295
```agda
9396
data _⊢_⇀⦇_,SUBUTXO⦈_ : UTxOEnv → UTxOState → SubLevelTx → UTxOState → Type where
@@ -104,8 +107,15 @@ data _⊢_⇀⦇_,UTXO⦈_ : UTxOEnv → UTxOState → TopLevelTx → UTxOState
104107
UTXO :
105108
let txb = Tx.txBody tx
106109
subTxs = TxBody.txSubTransactions txb
110+
utxo₀ = Γ .utxo₀
111+
utxo = s .utxo
107112
in
113+
∙ txIns ≢ ∅
114+
∙ txIns ⊆ dom utxo₀ -- (1)
115+
∙ refInputs ⊆ dom utxo
116+
108117
∙ requiredTopLevelGuardsSatisfied tx subTxs
118+
109119
∙ Γ ⊢ s ⇀⦇ tx ,UTXOS⦈ s'
110120
────────────────────────────────
111121
Γ ⊢ s ⇀⦇ tx ,UTXO⦈ s'

0 commit comments

Comments
 (0)