Skip to content

Commit 58fc737

Browse files
carlostomewilliamdemeo
authored andcommitted
Add preliminary check that txIns exist in the UTxO prior to any changes
1 parent 415a106 commit 58fc737

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

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

Lines changed: 32 additions & 5 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
@@ -52,10 +53,19 @@ record UTxOState : Type where
5253

5354
<!--
5455
```agda
56+
open UTxOEnv
57+
open UTxOState
58+
-- open UTxOState
59+
5560
private variable
5661
Γ : UTxOEnv
5762
s s' : UTxOState
5863
tx : TopLevelTx
64+
-- utxo : UTxO
65+
-- fees : Fees
66+
-- donations : Donations
67+
-- deposits : Deposits
68+
5969
```
6070
-->
6171

@@ -73,20 +83,37 @@ data _⊢_⇀⦇_,UTXOS⦈_ : UTxOEnv → UTxOState → TopLevelTx → UTxOState
7383
Γ ⊢ s ⇀⦇ tx ,UTXOS⦈ s
7484
```
7585

76-
## UTXO
86+
## The <span class="AgdaDatatype">UTXO</span> Transition System {#sec:the-utxo-transition-system}
87+
88+
### New in Dijkstra
7789

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

80-
This is the intended home of Dijkstra "phase-1 structural checks."
8193

8294
```agda
8395
data _⊢_⇀⦇_,UTXO⦈_ : UTxOEnv → UTxOState → TopLevelTx → UTxOState → Type where
8496
85-
UTXO-inductive :
86-
let txb = Tx.txBody tx
97+
UTXO :
98+
let
99+
```
100+
<!--
101+
```agda
102+
open Tx tx renaming (txBody to txb)
103+
open TxBody txb
104+
```
105+
-->
106+
```agda
87107
subTxs = TxBody.txSubTransactions txb
108+
utxo₀ = Γ .utxo₀
109+
utxo = s .utxo
88110
in
111+
∙ txIns ≢ ∅
112+
∙ txIns ⊆ dom utxo₀ -- (1)
113+
∙ refInputs ⊆ dom utxo
114+
89115
∙ requiredTopLevelGuardsSatisfied tx subTxs
116+
90117
∙ Γ ⊢ s ⇀⦇ tx ,UTXOS⦈ s'
91118
────────────────────────────────
92119
Γ ⊢ s ⇀⦇ tx ,UTXO⦈ s'

0 commit comments

Comments
 (0)