Skip to content

Commit bbd25c6

Browse files
committed
Add TODOs and NOTEs planning any future changes
1 parent bfd07cf commit bbd25c6

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

lib/PSR/ContextBuilder.hs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,20 @@ buildUtxoMapScan confHashes initialUtxoMap = Scanl.mkScanl step initial
167167

168168
transactionScan ::
169169
(Monad m) =>
170+
-- | Script hashes provided in the configuration.
170171
Set C.ScriptHash ->
172+
-- | Previous minimal UTxO state
171173
Map C.TxIn C.ScriptHash ->
172-
Scanl m (C.Tx era) (Map C.TxIn C.ScriptHash, (C.Tx era, Set C.ScriptHash))
174+
Scanl
175+
m
176+
(C.Tx era)
177+
( Map C.TxIn C.ScriptHash -- UTxO state after tx is applied
178+
, ( -- Transaction that is applied
179+
C.Tx era
180+
, -- Script hashes in the transaction that meet the criteria
181+
Set C.ScriptHash
182+
)
183+
)
173184
transactionScan confHashes initialUtxoMap =
174185
second withAllIntersectingPolicies
175186
<$> buildUtxoMapScan confHashes initialUtxoMap
@@ -188,6 +199,7 @@ transactionScan confHashes initialUtxoMap =
188199
Set.union nonSpendIntersectingPolicies spendIntersectingPolicies
189200
in (tx, allIntersectingPolicies)
190201

202+
-- QUESTION: Does it make sense to specialize the folds to Identity?
191203
selectScriptTriggeredTxs ::
192204
Set C.ScriptHash ->
193205
Map C.TxIn C.ScriptHash ->
@@ -293,6 +305,9 @@ mkTransactionContext' cm bc tx = do
293305
-- Evaluation
294306
--------------------------------------------------------------------------------
295307

308+
-- TODO: ResolvedScript is something that never changes and can be pretty
309+
-- large. It may be worth putting "Map.Map C.ScriptHash [ResolvedScript]" in a
310+
-- compact region.
296311
evaluateTransaction ::
297312
forall era.
298313
BlockContext era ->

lib/PSR/Streaming.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,13 @@ streamTransactionContext cbMetrics cm ctx1@BlockContext{..} =
259259
-- Main
260260
--------------------------------------------------------------------------------
261261

262+
-- TODO: Save the auxiliary state to disk when the application is exiting. When
263+
-- restarting, use the saved auxillary state instead of querying the state from
264+
-- the cardano-node.
265+
--
266+
-- NOTE: Think more about how we can reduce the bandwidth of the initial costly
267+
-- query.
268+
--
262269
mainLoop :: Events -> CM.ConfigMap -> [C.ChainPoint] -> IO ()
263270
mainLoop events cm@CM.ConfigMap{..} points = do
264271
metrics <- initialiseMetrics

0 commit comments

Comments
 (0)