Skip to content

Commit

Permalink
Add TODOs for proper init head observation
Browse files Browse the repository at this point in the history
see #720 for more details
  • Loading branch information
abailly authored and v0d1ch committed Feb 22, 2023
1 parent 1e8fbeb commit 6e37bbf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hydra-node/src/Hydra/Chain/Direct/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -594,13 +594,20 @@ observeInitTx ::
observeInitTx networkId cardanoKeys expectedCP party tx = do
-- FIXME: This is affected by "same structure datum attacks", we should be
-- using the Head script address instead.
-- TODO: find the head output the right way (using address)
-- TODO: check the datum contains out-ref
-- TODO: compute the theoretical headId gievn the out-ref and check it's consistent
-- with the head Id in the datum
-- TODO: check there's a ST at this output with the right headId
(ix, headOut, headData, headState) <- maybeOther $ findFirst headOutput indexedOutputs
(cp, ps) <- case headState of
(Head.Initial cp ps _headPolicyId) -> pure (cp, ps)
_ -> Left Other
parties <- maybeOther $ mapM partyFromChain ps
let contestationPeriod = fromChain cp
maybeOther $ guard $ expectedCP == contestationPeriod
-- TODO: check all the hydra keys are present in the datum and match what we expect
-- (need to pass those Hydra keys to the function)
maybeOther $ guard $ party `elem` parties
(headTokenPolicyId, headAssetName) <- maybeOther $ findHeadAssetId headOut
let expectedNames = assetNameFromVerificationKey <$> cardanoKeys
Expand Down

0 comments on commit 6e37bbf

Please sign in to comment.