From dce87f7bfd5bd7c684844414bd31b409907d4407 Mon Sep 17 00:00:00 2001 From: Franco Testagrossa Date: Tue, 31 Dec 2024 12:47:48 +0100 Subject: [PATCH] changes after rebase --- .../test/Hydra/Chain/Direct/TxTraceSpec.hs | 18 +++++++++--------- hydra-plutus/src/Hydra/Contract.hs | 1 - .../src/Hydra/SerialisedScriptRegistry.hs | 5 ++--- hydra-tx/src/Hydra/Tx/Deposit.hs | 4 ++-- hydra-tx/src/Hydra/Tx/Recover.hs | 3 --- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/hydra-node/test/Hydra/Chain/Direct/TxTraceSpec.hs b/hydra-node/test/Hydra/Chain/Direct/TxTraceSpec.hs index d18a6ae527c..0eac5160961 100644 --- a/hydra-node/test/Hydra/Chain/Direct/TxTraceSpec.hs +++ b/hydra-node/test/Hydra/Chain/Direct/TxTraceSpec.hs @@ -61,7 +61,7 @@ import Hydra.Tx.HeadId (headIdToCurrencySymbol, mkHeadId) import Hydra.Tx.Init (mkHeadOutput) import Hydra.Tx.IsTx (hashUTxO, utxoFromTx) import Hydra.Tx.Party (partyToChain) -import Hydra.Tx.ScriptRegistry (ScriptRegistry, registryUTxO, serialisedScriptRegistry) +import Hydra.Tx.ScriptRegistry (ScriptRegistry, registryUTxO) import Hydra.Tx.Snapshot (ConfirmedSnapshot (..), Snapshot (..), SnapshotNumber (..), SnapshotVersion (..), getSnapshot, number) import PlutusTx.Builtins (toBuiltin) import Test.Hydra.Tx.Fixture (alice, bob, carol, testNetworkId) @@ -700,14 +700,14 @@ performTx action result = Deposit{} -> (Just . getTxId . getTxBody $ tx, adjustUTxO tx utxo) _ -> (depositTxId, adjustUTxO tx utxo) put adjusted - let observation = observeHeadTx Fixture.testNetworkId serialisedScriptRegistry utxo tx - pure - TxResult - { constructedTx = Right tx - , spendableUTxO = utxo - , validationError - , observation - } + let observation = observeHeadTx Fixture.testNetworkId serialisedScriptRegistry utxo tx + pure + TxResult + { constructedTx = Right tx + , spendableUTxO = utxo + , validationError + , observation + } getValidationError :: Tx -> UTxO -> Maybe String getValidationError tx utxo = diff --git a/hydra-plutus/src/Hydra/Contract.hs b/hydra-plutus/src/Hydra/Contract.hs index 15e395154fd..d05450b8d64 100644 --- a/hydra-plutus/src/Hydra/Contract.hs +++ b/hydra-plutus/src/Hydra/Contract.hs @@ -14,7 +14,6 @@ import Hydra.Cardano.Api ( pattern PlutusScript, ) import Hydra.Cardano.Api.Prelude qualified as Api -import Hydra.Contract.Head qualified as Head import Hydra.Contract.HeadTokens qualified as HeadTokens import Hydra.Plutus (commitValidatorScript, depositValidatorScript, initialValidatorScript) import Hydra.SerialisedScriptRegistry (SerialisedScriptRegistry (..)) diff --git a/hydra-plutus/src/Hydra/SerialisedScriptRegistry.hs b/hydra-plutus/src/Hydra/SerialisedScriptRegistry.hs index 2cdab0df2e9..171437f5485 100644 --- a/hydra-plutus/src/Hydra/SerialisedScriptRegistry.hs +++ b/hydra-plutus/src/Hydra/SerialisedScriptRegistry.hs @@ -7,9 +7,8 @@ import Data.ByteString.Base16 qualified as Base16 import Data.ByteString.Lazy qualified as LBS import Data.ByteString.Short qualified as SBS -import Hydra.Contract.Deposit qualified as Deposit import Hydra.Contract.Head qualified as Head -import Hydra.Plutus (commitValidatorScript, initialValidatorScript) +import Hydra.Plutus (commitValidatorScript, depositValidatorScript, initialValidatorScript) import PlutusLedgerApi.Common (SerialisedScript) data SerialisedScriptRegistry = SerialisedScriptRegistry @@ -26,7 +25,7 @@ serialisedScriptRegistry = { initialScriptValidator = initialValidatorScript , commitScriptValidator = commitValidatorScript , headScriptValidator = Head.validatorScript - , depositScriptValidator = Deposit.validatorScript + , depositScriptValidator = depositValidatorScript } -- XXX: used to parse Aiken `compiledCode`. diff --git a/hydra-tx/src/Hydra/Tx/Deposit.hs b/hydra-tx/src/Hydra/Tx/Deposit.hs index 1840097a84d..dd13120ed92 100644 --- a/hydra-tx/src/Hydra/Tx/Deposit.hs +++ b/hydra-tx/src/Hydra/Tx/Deposit.hs @@ -82,7 +82,7 @@ observeDepositTx :: Maybe DepositObservation observeDepositTx networkId SerialisedScriptRegistry{depositScriptValidator} tx = do -- TODO: could just use the first output and fail otherwise - (TxIn depositTxId _, depositOut) <- findTxOutByAddress (depositAddress networkId) tx + (TxIn depositTxId _, depositOut) <- findTxOutByAddress depositAddr tx (headId, deposited, deadline) <- observeDepositTxOut (networkIdToNetwork networkId) (toCtxUTxOTxOut depositOut) if all (`elem` txIns' tx) (UTxO.inputSet deposited) then @@ -97,7 +97,7 @@ observeDepositTx networkId SerialisedScriptRegistry{depositScriptValidator} tx = where depositScript = fromPlutusScript depositScriptValidator - depositAddress = mkScriptAddress @PlutusScriptV3 networkId depositScript + depositAddr = mkScriptAddress @PlutusScriptV3 networkId depositScript observeDepositTxOut :: Network -> diff --git a/hydra-tx/src/Hydra/Tx/Recover.hs b/hydra-tx/src/Hydra/Tx/Recover.hs index ddc1afc901a..77c9ae30755 100644 --- a/hydra-tx/src/Hydra/Tx/Recover.hs +++ b/hydra-tx/src/Hydra/Tx/Recover.hs @@ -13,11 +13,8 @@ import Hydra.Ledger.Cardano.Builder ( setValidityLowerBound, unsafeBuildTransaction, ) -<<<<<<< HEAD import Hydra.Plutus (depositValidatorScript) -======= import Hydra.SerialisedScriptRegistry (SerialisedScriptRegistry (..)) ->>>>>>> 9cb6d7a62 (move SerialisedScriptRegistry to hydra-plutus) import Hydra.Tx (HeadId, mkHeadId) import Hydra.Tx.Utils (mkHydraHeadV1TxName)