Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't keep deposit script utxo in local state #1692

Merged
merged 12 commits into from
Oct 10, 2024
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ changes.
Important to note is that on-chain security is not implemented and hydra-node in this
state is not releasable!
Missing off-chain items to implement as a series of next PR's:
- Use the observed UTxO to construct increment/recover
- Add documentation to explain the feature
- Implement tests scenarios outlined in the [incremental-commit] (https://github.com/cardano-scaling/hydra/issues/199) issue
- Remove Commit client input since it is unused
Expand Down
8 changes: 6 additions & 2 deletions hydra-cardano-api/src/Cardano/Api/UTxO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ resolve k = Map.lookup k . toMap
pairs :: UTxO' out -> [(TxIn, out)]
pairs = Map.toList . toMap

-- | Find first 'UTxO' which satisfies given predicate.
-- | Find first 'UTxO' using the output in predicate.
find :: (out -> Bool) -> UTxO' out -> Maybe (TxIn, out)
find fn utxo = List.find (fn . snd) $ pairs utxo
find fn = findBy (fn . snd)

-- | Find first 'UTxO' using both input and output in predicate.
findBy :: ((TxIn, out) -> Bool) -> UTxO' out -> Maybe (TxIn, out)
findBy fn utxo = List.find fn $ pairs utxo
noonio marked this conversation as resolved.
Show resolved Hide resolved

-- | Filter UTxO to only include 'out's satisfying given predicate.
filter :: (out -> Bool) -> UTxO' out -> UTxO' out
Expand Down
4 changes: 2 additions & 2 deletions hydra-cluster/src/Hydra/Cluster/Scenarios.hs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ singlePartyCommitsScriptBlueprint tracer workDir node hydraScriptsTxId =
waitFor hydraTracer 10 [n1] $
output "CommitApproved" ["headId" .= headId, "utxoToCommit" .= scriptUTxO']
waitFor hydraTracer 10 [n1] $
output "CommitFinalized" ["headId" .= headId, "utxo" .= scriptUTxO', "theDeposit" .= getTxId (getTxBody tx)]
output "CommitFinalized" ["headId" .= headId, "theDeposit" .= getTxId (getTxBody tx)]

send n1 $ input "GetUTxO" []

Expand Down Expand Up @@ -732,7 +732,7 @@ canCommit tracer workDir node hydraScriptsTxId =
waitFor hydraTracer 10 [n1] $
output "CommitApproved" ["headId" .= headId, "utxoToCommit" .= commitUTxO]
waitFor hydraTracer 10 [n1] $
output "CommitFinalized" ["headId" .= headId, "utxo" .= commitUTxO, "theDeposit" .= getTxId (getTxBody tx)]
output "CommitFinalized" ["headId" .= headId, "theDeposit" .= getTxId (getTxBody tx)]

send n1 $ input "GetUTxO" []

Expand Down
17,393 changes: 17,393 additions & 0 deletions hydra-node/golden/ReasonablySized (ServerOutput (Tx ConwayEra)).json

Large diffs are not rendered by default.

Loading