Skip to content

Commit

Permalink
Identified problem: autobalancing
Browse files Browse the repository at this point in the history
  • Loading branch information
noonio committed Jan 15, 2025
1 parent a53793b commit 6d43e60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion hydra-cluster/hydra-cluster.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ library
, typed-process
, unix
, websockets
, cardano-api

ghc-options: -haddock

Expand Down
21 changes: 11 additions & 10 deletions hydra-cluster/src/Hydra/Cluster/Scenarios.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import Hydra.Cardano.Api (
addTxIns,
addTxInsCollateral,
addTxOuts,
createAndValidateTransactionBody,
defaultTxBodyContent,
getTxBody,
getTxId,
Expand Down Expand Up @@ -418,7 +419,6 @@ singlePartyUsesSchnorrkelScriptOnL2 tracer workDir node hydraScriptsTxId =
-- Push it into L2
requestCommitTx n1 utxoToCommit
<&> signTx walletSk >>= \tx -> do
-- putStrLn $ renderTxWithUTxO utxoToCommit tx
submitTx node tx

-- Check UTxO is present in L2
Expand Down Expand Up @@ -457,22 +457,23 @@ singlePartyUsesSchnorrkelScriptOnL2 tracer workDir node hydraScriptsTxId =
ScriptWitness scriptWitnessInCtx $
mkScriptWitness serializedScript (mkScriptDatum ()) (toScriptData ())

let txIn = mkTxIn signedL2tx 0

putStrLn "UTxO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
putStrLn $ renderTxWithUTxO utxoToCommit tx
putStrLn "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ UTxO"
-- Note: Bug! autobalancing breaks the script business
-- tx <- either (failure . show) pure =<< buildTransactionWithBody networkId nodeSocket (mkVkAddress networkId walletVk) body utxoToCommit

-- TODO: Include the script as an input!
let txIn = mkTxIn signedL2tx 0
let body =
defaultTxBodyContent
& addTxIns [(txIn, scriptWitness)]

print body

tx <- either (failure . show) pure =<< buildTransactionWithBody networkId nodeSocket (mkVkAddress networkId walletVk) body utxoToCommit
-- Note: Fix! Use `createAndValidateTransactionBody` instead. This
-- means we _can_ construct the tx; but it doesn't submit (because it
-- isn't balanced! And it's missing collateral, etc...
txBody <- either (failure . show) pure (createAndValidateTransactionBody body)
let tx = makeSignedTransaction [] txBody
let signedL2tx = signTx walletSk tx

send n1 $ input "NewTx" ["transaction" .= signedL2tx]

waitMatch 10 n1 $ \v -> do
guard $ v ^? key "tag" == Just "SnapshotConfirmed"
guard $
Expand Down

0 comments on commit 6d43e60

Please sign in to comment.