diff --git a/cabal.project b/cabal.project index fff10556092..5497dcce253 100644 --- a/cabal.project +++ b/cabal.project @@ -12,8 +12,8 @@ repository cardano-haskell-packages -- See CONTRIBUTING.md for information about when and how to update these. index-state: - , hackage.haskell.org 2024-11-22T14:59:16Z - , cardano-haskell-packages 2024-12-20T15:52:56Z + , hackage.haskell.org 2025-01-15T13:32:16Z + , cardano-haskell-packages 2025-01-15T09:59:24Z packages: hydra-prelude @@ -42,9 +42,13 @@ test-show-details: direct program-options ghc-options: -fwrite-ide-info -constraints: - quickcheck-instances==0.3.31, - data-default==0.7.1.3 +--source-repository-package +-- type: git +-- location: https://github.com/IntersectMBO/cardano-api +-- tag: 271099ce20b9767367fc0ecdb1a6f2d0f71a00f7 +-- --sha256: sha256-6PImVY8AHDPHk76wADaV+JIjtTVlKM9rwKw2sBFxD14= +-- subdir: +-- cardano-api source-repository-package type: git @@ -57,10 +61,10 @@ source-repository-package source-repository-package type: git location: https://github.com/locallycompact/plutus - tag: b117b4460b5b5da2a599db8693b18dacd811bb91 - --sha256: sha256-GUPwIwbTOy/eTBhjOwrR+XwJsML/jmBlAf1qU6zWvd8= + tag: d4f1bc056e4db3f3d71af9069f355a97d326b29b + --sha256: sha256-w3vtZ8v4nGAkeGoNjd5kZly7fv4QPm/iEgyg3EasZAM= subdir: - prettyprinter-configurable + -- prettyprinter-configurable plutus-core plutus-ledger-api plutus-tx-plugin diff --git a/flake.lock b/flake.lock index f72483a22d6..7558745e0d3 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1734943824, - "narHash": "sha256-kcyysnPJbjdJOmtTldC08xj2Ttp2XcY6ecbYOYdwkmY=", + "lastModified": 1736937016, + "narHash": "sha256-dmLSu2SvSaTDjSE03cU6DwY62J3nWJbVhIn/kKtMwJg=", "owner": "IntersectMBO", "repo": "cardano-haskell-packages", - "rev": "6ec767f1afd771816c5f3b383d0e1d3b577d72fe", + "rev": "045875beec586ff57a7333c0563fd5c2b1a308fa", "type": "github" }, "original": { diff --git a/hydra-cardano-api/hydra-cardano-api.cabal b/hydra-cardano-api/hydra-cardano-api.cabal index f4130ffcc78..2130f6798eb 100644 --- a/hydra-cardano-api/hydra-cardano-api.cabal +++ b/hydra-cardano-api/hydra-cardano-api.cabal @@ -77,7 +77,7 @@ library , aeson >=2 , base >=4.16 , bytestring - , cardano-api ^>=10.5 + , cardano-api ^>=10.6 , cardano-api:gen , cardano-binary , cardano-crypto-class diff --git a/hydra-cardano-api/src/Hydra/Cardano/Api/Prelude.hs b/hydra-cardano-api/src/Hydra/Cardano/Api/Prelude.hs index e3f3c028f68..7f6806a8e83 100644 --- a/hydra-cardano-api/src/Hydra/Cardano/Api/Prelude.hs +++ b/hydra-cardano-api/src/Hydra/Cardano/Api/Prelude.hs @@ -40,7 +40,7 @@ import Cardano.Crypto.Hash.Class qualified as CC import Cardano.Ledger.Binary qualified as Ledger import Cardano.Ledger.Core qualified as Ledger import Cardano.Ledger.Crypto (StandardCrypto) -import Cardano.Ledger.Era (EraCrypto) +import Cardano.Ledger.Core (EraCrypto) import Data.Aeson (FromJSON (..), ToJSON (..)) import Data.ByteString (ByteString) import Data.ByteString.Lazy (fromStrict, toStrict) diff --git a/hydra-cardano-api/src/Hydra/Cardano/Api/ScriptData.hs b/hydra-cardano-api/src/Hydra/Cardano/Api/ScriptData.hs index 2efc3ab5e46..6ebce1c9b2b 100644 --- a/hydra-cardano-api/src/Hydra/Cardano/Api/ScriptData.hs +++ b/hydra-cardano-api/src/Hydra/Cardano/Api/ScriptData.hs @@ -4,7 +4,7 @@ module Hydra.Cardano.Api.ScriptData where import Hydra.Cardano.Api.Prelude hiding (left) -import Cardano.Ledger.Era qualified as Ledger +import Cardano.Ledger.Core qualified as Ledger import Cardano.Ledger.Plutus.Data qualified as Ledger import PlutusLedgerApi.V3 qualified as Plutus diff --git a/hydra-cluster/src/Hydra/Cluster/Scenarios.hs b/hydra-cluster/src/Hydra/Cluster/Scenarios.hs index 66a876e7edd..90baa872c5e 100644 --- a/hydra-cluster/src/Hydra/Cluster/Scenarios.hs +++ b/hydra-cluster/src/Hydra/Cluster/Scenarios.hs @@ -457,19 +457,20 @@ singlePartyUsesSchnorrkelScriptOnL2 tracer workDir node hydraScriptsTxId = ScriptWitness scriptWitnessInCtx $ mkScriptWitness serializedScript (mkScriptDatum ()) (toScriptData ()) - -- Note: Bug! autobalancing breaks the script business - -- tx <- either (failure . show) pure =<< buildTransactionWithBody networkId nodeSocket (mkVkAddress networkId walletVk) body utxoToCommit - let txIn = mkTxIn signedL2tx 0 let body = defaultTxBodyContent & addTxIns [(txIn, scriptWitness)] + -- Note: Bug! autobalancing breaks the script business + 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 + -- txBody <- either (failure . show) pure (createAndValidateTransactionBody body) + -- let tx = makeSignedTransaction [] txBody + let signedL2tx = signTx walletSk tx send n1 $ input "NewTx" ["transaction" .= signedL2tx] diff --git a/hydra-node/src/Hydra/Ledger/Cardano.hs b/hydra-node/src/Hydra/Ledger/Cardano.hs index 5b03ee33921..9dcf0aa6835 100644 --- a/hydra-node/src/Hydra/Ledger/Cardano.hs +++ b/hydra-node/src/Hydra/Ledger/Cardano.hs @@ -96,6 +96,7 @@ newLedgerEnv protocolParams = Ledger.ledgerAccount = Ledger.AccountState mempty mempty , Ledger.ledgerPp = protocolParams , Ledger.ledgerMempool = False + , Ledger.ledgerEpochNo = Nothing } -- * Conversions and utilities diff --git a/hydra-node/src/Hydra/Network.hs b/hydra-node/src/Hydra/Network.hs index a1edb7f49aa..6c28fb50d30 100644 --- a/hydra-node/src/Hydra/Network.hs +++ b/hydra-node/src/Hydra/Network.hs @@ -31,7 +31,7 @@ import Cardano.Ledger.Orphans () import Data.IP (IP, toIPv4w) import Data.Text (pack, unpack) import Network.Socket (PortNumber, close) -import Network.TypedProtocol.Pipelined () +-- import Network.TypedProtocol.Pipelined () import Test.QuickCheck (elements, listOf, suchThat) import Text.Read (Read (readsPrec)) import Text.Show (Show (show)) diff --git a/hydra-node/src/Hydra/Network/Ouroboros/Type.hs b/hydra-node/src/Hydra/Network/Ouroboros/Type.hs index f0e28a92251..a9477b2c9d5 100644 --- a/hydra-node/src/Hydra/Network/Ouroboros/Type.hs +++ b/hydra-node/src/Hydra/Network/Ouroboros/Type.hs @@ -5,7 +5,8 @@ import Hydra.Prelude import Cardano.Binary qualified as CBOR import Codec.CBOR.Read qualified as CBOR import GHC.Show (Show (show)) -import Network.TypedProtocol (PeerHasAgency (ClientAgency), Protocol (..)) +import Network.TypedProtocol.Core (ReflRelativeAgency (ReflClientAgency)) +import Network.TypedProtocol (Protocol (..)) import Network.TypedProtocol.Codec (Codec) import Network.TypedProtocol.Codec.CBOR (mkCodecCborLazyBS) import Network.TypedProtocol.Core (PeerRole) @@ -77,8 +78,8 @@ codecFireForget = mkCodecCborLazyBS encodeMsg decodeMsg PeerHasAgency pr st -> Message (FireForget a) st st' -> CBOR.Encoding - encodeMsg (ClientAgency TokIdle) MsgDone = CBOR.encodeWord 0 - encodeMsg (ClientAgency TokIdle) (MsgSend msg) = CBOR.encodeWord 1 <> toCBOR msg + encodeMsg (ReflClientAgency TokIdle) MsgDone = CBOR.encodeWord 0 + encodeMsg (ReflClientAgency TokIdle) (MsgSend msg) = CBOR.encodeWord 1 <> toCBOR msg decodeMsg :: forall (pr :: PeerRole) s (st :: FireForget a). @@ -87,9 +88,9 @@ codecFireForget = mkCodecCborLazyBS encodeMsg decodeMsg decodeMsg stok = do key <- CBOR.decodeWord case (stok, key) of - (ClientAgency TokIdle, 0) -> + (ReflClientAgency TokIdle, 0) -> return $ SomeMessage MsgDone - (ClientAgency TokIdle, 1) -> do + (ReflClientAgency TokIdle, 1) -> do SomeMessage . MsgSend <$> fromCBOR - (ClientAgency TokIdle, _) -> + (ReflClientAgency TokIdle, _) -> fail "codecFireForget.StIdle: unexpected key" diff --git a/hydra-node/src/Hydra/Network/Ouroboros/VersionedProtocol.hs b/hydra-node/src/Hydra/Network/Ouroboros/VersionedProtocol.hs index 6ca0d7f6e7d..5e09fbe8900 100644 --- a/hydra-node/src/Hydra/Network/Ouroboros/VersionedProtocol.hs +++ b/hydra-node/src/Hydra/Network/Ouroboros/VersionedProtocol.hs @@ -8,7 +8,7 @@ import GHC.Natural (naturalFromInteger, naturalToInteger) import GHC.Num (integerToInt) import Hydra.Network (Host (..)) import Hydra.Network.Message (HydraVersionedProtocolNumber (..)) -import Network.TypedProtocol.Pipelined () +-- import Network.TypedProtocol.Pipelined () import Ouroboros.Network.CodecCBORTerm (CodecCBORTerm (..)) import Ouroboros.Network.Protocol.Handshake.Codec (VersionDataCodec, cborTermVersionDataCodec) import Ouroboros.Network.Protocol.Handshake.Version (Accept (..), Acceptable, Queryable, acceptableVersion, queryVersion) diff --git a/hydra-plutus/src/Hydra/Contract/Head.hs b/hydra-plutus/src/Hydra/Contract/Head.hs index a8bbe976b0c..ed2d6fc098f 100644 --- a/hydra-plutus/src/Hydra/Contract/Head.hs +++ b/hydra-plutus/src/Hydra/Contract/Head.hs @@ -60,6 +60,7 @@ import PlutusLedgerApi.V3 ( TxOut (..), UpperBound (..), Value (Value), + mintValueMinted, ) import PlutusLedgerApi.V3.Contexts (findOwnInput, findTxInByTxOutRef) import PlutusTx (CompiledCode) @@ -117,7 +118,7 @@ checkAbort ctx@ScriptContext{scriptContextTxInfo = txInfo} headCurrencySymbol pa && mustBeSignedByParticipant ctx headCurrencySymbol && mustReimburseCommittedUTxO where - minted = txInfoMint txInfo + minted = mintValueMinted $ txInfoMint txInfo mustReimburseCommittedUTxO = traceIfFalse $(errorCode ReimbursedOutputsDontMatch) $ @@ -653,7 +654,7 @@ checkFanout ScriptContext{scriptContextTxInfo = txInfo} closedDatum numberOfFano && hasSameDecommitUTxOHash && afterContestationDeadline where - minted = txInfoMint txInfo + minted = mintValueMinted $ txInfoMint txInfo hasSameUTxOHash = traceIfFalse $(errorCode FanoutUTxOHashMismatch) $ diff --git a/hydra-plutus/src/Hydra/Contract/HeadTokens.hs b/hydra-plutus/src/Hydra/Contract/HeadTokens.hs index 664fb7374ba..5490314466d 100644 --- a/hydra-plutus/src/Hydra/Contract/HeadTokens.hs +++ b/hydra-plutus/src/Hydra/Contract/HeadTokens.hs @@ -46,6 +46,7 @@ import PlutusLedgerApi.V3 ( TxOutRef, Value (getValue), serialiseCompiledCode, + mintValueMinted ) import PlutusLedgerApi.V3.Contexts (ownCurrencySymbol) import PlutusTx (CompiledCode) @@ -136,6 +137,7 @@ validateTokensMinting initialValidator headValidator seedInput context = maybe 0 sum . AssocMap.lookup currency . getValue + . mintValueMinted $ txInfoMint txInfo (headId, seed, nParties) = @@ -173,7 +175,8 @@ validateTokensBurning context = ScriptContext{scriptContextTxInfo = txInfo} = context - minted = getValue $ txInfoMint txInfo + -- TODO: Should this be burned our minted?! + minted = getValue . mintValueMinted $ txInfoMint txInfo burnHeadTokens = case AssocMap.lookup currency minted of diff --git a/hydra-plutus/src/Hydra/Contract/Util.hs b/hydra-plutus/src/Hydra/Contract/Util.hs index be0c5b0552b..fd7e3f9e1d6 100644 --- a/hydra-plutus/src/Hydra/Contract/Util.hs +++ b/hydra-plutus/src/Hydra/Contract/Util.hs @@ -21,6 +21,7 @@ import PlutusLedgerApi.V3 ( TxOutRef (..), Value (getValue), toBuiltinData, + mintValueMinted ) import PlutusTx.AssocMap qualified as AssocMap import PlutusTx.Builtins (serialiseData) @@ -57,7 +58,7 @@ mustBurnAllHeadTokens minted headCurrencySymbol parties = mustNotMintOrBurn :: TxInfo -> Bool mustNotMintOrBurn TxInfo{txInfoMint} = traceIfFalse "U01" $ - isZero txInfoMint + isZero (mintValueMinted txInfoMint) {-# INLINEABLE mustNotMintOrBurn #-} infix 4 ===