Skip to content

Commit 7844329

Browse files
carlostomewilliamdemeo
authored andcommitted
Add documentation
1 parent 73f12ab commit 7844329

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,29 @@ data _⊢_⇀⦇_,UTXOS⦈_ : UTxOEnv → UTxOState → TopLevelTx → UTxOState
101101

102102
### New in Dijkstra
103103

104-
1. The set of spending inputs must exist in the UTxO _before_ applying the
105-
transaction (or partially applying any part of it). TODO: Add link to CIP once its finalized.
104+
The CIP (TODO: add reference) states:
105+
106+
> All inputs of all transactions in a single batch must be contained in the UTxO
107+
set before any of the batch transactions are applied. This ensures that
108+
operation of scripts is not disrupted, for example, by temporarily duplicating
109+
thread tokens, or falsifying access to assets via flash loans. In the future,
110+
this may be up for reconsideration.
106111

112+
This is achieved by the following precondition in the `UTXO`.{AgdaDatatype} and
113+
`SUBUTXO`.{AgdaDatatype} rules:
114+
115+
1. The set of spending inputs must exist in the UTxO _before_ applying the
116+
transaction (or partially applying any part of it).
107117

108118
```agda
109119
data _⊢_⇀⦇_,SUBUTXO⦈_ : UTxOEnv → UTxOState → SubLevelTx → UTxOState → Type where
110120
111121
SUBUTXO :
112122
123+
∙ SpendInputsOf tx ≢ ∅
124+
∙ SpendInputsOf tx ⊆ dom (UTxOOf Γ) -- (1)
125+
∙ SpendInputsOf tx ⊆ dom (UTxOOf s)
126+
∙ ReferenceInputsOf tx ⊆ dom (UTxOOf s)
113127
────────────────────────────────
114128
Γ ⊢ s ⇀⦇ stx ,SUBUTXO⦈ s'
115129
@@ -119,18 +133,14 @@ data _⊢_⇀⦇_,UTXO⦈_ : UTxOEnv → UTxOState → TopLevelTx → UTxOState
119133
120134
∙ SpendInputsOf tx ≢ ∅
121135
∙ SpendInputsOf tx ⊆ dom (UTxOOf Γ) -- (1)
136+
∙ SpendInputsOf tx ⊆ dom (UTxOOf s)
122137
∙ ReferenceInputsOf tx ⊆ dom (UTxOOf s)
123138
∙ requiredTopLevelGuardsSatisfied tx (SubTransactionsOf tx) -- (2)
124139
∙ Γ ⊢ s ⇀⦇ tx ,UTXOS⦈ s'
125140
────────────────────────────────
126141
Γ ⊢ s ⇀⦇ tx ,UTXO⦈ s'
127142
```
128143

129-
**Notes**.
130-
131-
1. The set of spending inputs must exist in the UTxO *before* applying the
132-
transaction (or partially applying any part of it).
133-
134144
2. The premise `requiredTopLevelGuardsSatisfied tx subTxs` is explicitly a
135145
phase-1 condition (CIP-0118): every guard credential requested by subtransaction
136146
bodies must appear in the top-level `txGuards` set.

0 commit comments

Comments
 (0)