From 71814959673ac1b47dd0a591359bb334817271d8 Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Fri, 17 May 2024 08:48:49 +0000 Subject: [PATCH] cardano-node: 8.9.0 -> 8.11.0-pre --- cabal.project | 6 +- cardano-api-classy/cardano-api-classy.cabal | 2 +- docs/docs/tutorial/index.md | 4 +- flake.lock | 231 +++++++++--------- flake.nix | 2 +- hydra-cardano-api/hydra-cardano-api.cabal | 2 +- hydra-cardano-api/src/Hydra/Cardano/Api/Tx.hs | 14 +- .../src/Hydra/Cardano/Api/TxBody.hs | 4 +- .../config/devnet/genesis-conway.json | 5 +- hydra-cluster/test/Test/CardanoNodeSpec.hs | 2 +- hydra-node/hydra-node.cabal | 8 +- hydra-node/src/Hydra/Chain/Direct/Tx.hs | 26 +- hydra-node/src/Hydra/Chain/Direct/Wallet.hs | 18 +- .../src/Hydra/Ledger/Cardano/Evaluate.hs | 5 +- .../src/Hydra/Plutus/Orphans.hs | 6 +- plutus-cbor/bench/Main.hs | 8 +- plutus-cbor/exe/encoding-cost/Main.hs | 8 +- .../test/Plutus/Codec/CBOR/EncodingSpec.hs | 4 +- 18 files changed, 191 insertions(+), 164 deletions(-) diff --git a/cabal.project b/cabal.project index f560483df58..6178c8b5741 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-04-09T15:27:52Z - , cardano-haskell-packages 2024-04-08T15:27:49Z + , hackage.haskell.org 2024-05-19T15:27:52Z + , cardano-haskell-packages 2024-05-19T15:27:49Z packages: cardano-api-classy @@ -41,3 +41,5 @@ benchmarks: True -- Always show detailed output for tests test-show-details: direct + +constraints: io-classes-mtl == 0.1.1.0 diff --git a/cardano-api-classy/cardano-api-classy.cabal b/cardano-api-classy/cardano-api-classy.cabal index 8fe04aded20..fc966c1b695 100644 --- a/cardano-api-classy/cardano-api-classy.cabal +++ b/cardano-api-classy/cardano-api-classy.cabal @@ -54,7 +54,7 @@ library -- dependencies on cardano-ledger* follow. build-depends: , base >=4.16 - , cardano-api ^>=8.44 + , cardano-api ^>=8.46 , cardano-ledger-alonzo , cardano-ledger-conway , cardano-ledger-core diff --git a/docs/docs/tutorial/index.md b/docs/docs/tutorial/index.md index 25bc1b17584..5fb9a67eb30 100644 --- a/docs/docs/tutorial/index.md +++ b/docs/docs/tutorial/index.md @@ -40,7 +40,7 @@ mkdir -p bin version=0.16.0 curl -L -O https://github.com/input-output-hk/hydra/releases/download/${version}/hydra-x86_64-linux-${version}.zip unzip -d bin hydra-x86_64-linux-${version}.zip -curl -L -o - https://github.com/input-output-hk/cardano-node/releases/download/8.9.0/cardano-node-8.9.0-linux.tar.gz \ +curl -L -o - https://github.com/input-output-hk/cardano-node/releases/download/8.11.0/cardano-node-8.11.0-linux.tar.gz \ | tar xz ./bin/cardano-node ./bin/cardano-cli curl -L -o - https://github.com/input-output-hk/mithril/releases/download/2412.0/mithril-2412.0-linux-x64.tar.gz \ | tar xz -C bin mithril-client @@ -55,7 +55,7 @@ mkdir -p bin version=0.16.0 curl -L -O https://github.com/input-output-hk/hydra/releases/download/${version}/hydra-aarch64-darwin-${version}.zip unzip -d bin hydra-aarch64-darwin-${version}.zip -curl -L -o - https://github.com/input-output-hk/cardano-node/releases/download/8.9.0/cardano-node-8.9.0-macos.tar.gz \ +curl -L -o - https://github.com/input-output-hk/cardano-node/releases/download/8.11.0/cardano-node-8.11.0-macos.tar.gz \ | tar xz --wildcards ./bin/cardano-node ./bin/cardano-cli './bin/*.dylib' curl -L -o - https://github.com/input-output-hk/mithril/releases/download/2412.0/mithril-2412.0-macos-x64.tar.gz \ | tar xz -C bin diff --git a/flake.lock b/flake.lock index 8cffee22ad3..c6301787d1e 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1712590917, - "narHash": "sha256-DgXSWHF5b/UtM+ACBWLPNtMNTSGQrmtl/ME7e7dheLo=", + "lastModified": 1715802876, + "narHash": "sha256-fy8xdNgFXJvX0UnW0HNdhcZA/n0FGomkshJExKUcjUs=", "owner": "IntersectMBO", "repo": "cardano-haskell-packages", - "rev": "251738d00d5799850c6eb610c4ab7b175b66224a", + "rev": "70c2100e4206788b082a836046a5133902a1ceb1", "type": "github" }, "original": { @@ -20,11 +20,11 @@ "CHaP_2": { "flake": false, "locked": { - "lastModified": 1709731402, - "narHash": "sha256-7h4/ns3WRI3BtK1FbUEm6nMqW1ahNNehiHr7eQ03muk=", + "lastModified": 1715690409, + "narHash": "sha256-+PWaq7ngq5d601d+GBNggNuzT+jXSV7Dl2IrMNCY1KQ=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "8e4f211a8e537c8c939b65e887556bd7441c774c", + "rev": "0ce6797192cbbab051cd8fe5b7516b55273229f1", "type": "github" }, "original": { @@ -305,16 +305,16 @@ "utils": "utils_2" }, "locked": { - "lastModified": 1709733493, - "narHash": "sha256-chcwbks+HyImFk7FpbkC7FFmfpScMx5T7K0TzTkGAww=", + "lastModified": 1715793024, + "narHash": "sha256-BoTWJKRc7gWSzptEuk32A/uV6MRkRx7vKdz34k8IPY8=", "owner": "intersectmbo", "repo": "cardano-node", - "rev": "0d98405a60d57e1c8e13406d51cce0e34356bd64", + "rev": "38c7f1cf2db12dff9c814ad10049f411a4b30448", "type": "github" }, "original": { "owner": "intersectmbo", - "ref": "8.9.0", + "ref": "8.11.0-pre", "repo": "cardano-node", "type": "github" } @@ -840,52 +840,52 @@ "type": "github" } }, - "ghc98X": { + "ghc910X": { "flake": false, "locked": { - "lastModified": 1696643148, - "narHash": "sha256-E02DfgISH7EvvNAu0BHiPvl1E5FGMDi0pWdNZtIBC9I=", - "ref": "ghc-9.8", - "rev": "443e870d977b1ab6fc05f47a9a17bc49296adbd6", - "revCount": 61642, + "lastModified": 1711543129, + "narHash": "sha256-MUI07CxYOng7ZwHnMCw0ugY3HmWo2p/f4r07CGV7OAM=", + "ref": "ghc-9.10", + "rev": "6ecd5f2ff97af53c7334f2d8581651203a2c6b7d", + "revCount": 62607, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" }, "original": { - "ref": "ghc-9.8", + "ref": "ghc-9.10", "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" } }, - "ghc98X_2": { + "ghc910X_2": { "flake": false, "locked": { - "lastModified": 1696643148, - "narHash": "sha256-E02DfgISH7EvvNAu0BHiPvl1E5FGMDi0pWdNZtIBC9I=", - "ref": "ghc-9.8", - "rev": "443e870d977b1ab6fc05f47a9a17bc49296adbd6", - "revCount": 61642, + "lastModified": 1714520650, + "narHash": "sha256-4uz6RA1hRr0RheGNDM49a/B3jszqNNU8iHIow4mSyso=", + "ref": "ghc-9.10", + "rev": "2c6375b9a804ac7fca1e82eb6fcfc8594c67c5f5", + "revCount": 62663, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" }, "original": { - "ref": "ghc-9.8", + "ref": "ghc-9.10", "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" } }, - "ghc99": { + "ghc911": { "flake": false, "locked": { - "lastModified": 1701580282, - "narHash": "sha256-drA01r3JrXnkKyzI+owMZGxX0JameMzjK0W5jJE/+V4=", + "lastModified": 1711538967, + "narHash": "sha256-KSdOJ8seP3g30FaC2du8QjU9vumMnmzPR5wfkVRXQMk=", "ref": "refs/heads/master", - "rev": "f5eb0f2982e9cf27515e892c4bdf634bcfb28459", - "revCount": 62197, + "rev": "0acfe391583d77a72051d505f05fab0ada056c49", + "revCount": 62632, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" @@ -896,14 +896,14 @@ "url": "https://gitlab.haskell.org/ghc/ghc" } }, - "ghc99_2": { + "ghc911_2": { "flake": false, "locked": { - "lastModified": 1701580282, - "narHash": "sha256-drA01r3JrXnkKyzI+owMZGxX0JameMzjK0W5jJE/+V4=", + "lastModified": 1714817013, + "narHash": "sha256-m2je4UvWfkgepMeUIiXHMwE6W+iVfUY38VDGkMzjCcc=", "ref": "refs/heads/master", - "rev": "f5eb0f2982e9cf27515e892c4bdf634bcfb28459", - "revCount": 62197, + "rev": "fc24c5cf6c62ca9e3c8d236656e139676df65034", + "revCount": 62816, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" @@ -936,11 +936,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1712622274, - "narHash": "sha256-LpQUA5rdy1lwxaH2FtGXp0eHg9fUJa2e00G4owuakJU=", + "lastModified": 1716078842, + "narHash": "sha256-ehsF2ijLNQ89XfEU68Qd4HBeC14Il2w4LhzZBp5jH9o=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "50976bfc1171f31a9d447516efc33702741cb356", + "rev": "98e78a010b2138c4b0451943aa8c363371ec21c8", "type": "github" }, "original": { @@ -952,11 +952,11 @@ "hackageNix": { "flake": false, "locked": { - "lastModified": 1709684582, - "narHash": "sha256-+rC8Vpaxdd4Nw2fJIn9wzAnzW5arILly5AkTG6chRAw=", + "lastModified": 1711412520, + "narHash": "sha256-48Aw1X7IuXZR6Wi2WOlvj9HpoUHty/JW1MqAehgnoHo=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "c2ed9aa79252ed67a1fb694b3fffaf7dd7ead6d2", + "rev": "fc84d1170ccc83d50db7b71a6edd090b2cef7657", "type": "github" }, "original": { @@ -974,8 +974,8 @@ "cardano-shell": "cardano-shell", "flake-compat": "flake-compat_3", "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", - "ghc98X": "ghc98X", - "ghc99": "ghc99", + "ghc910X": "ghc910X", + "ghc911": "ghc911", "hackage": [ "cardano-node", "hackageNix" @@ -990,7 +990,6 @@ "hpc-coveralls": "hpc-coveralls", "hydra": "hydra", "iserv-proxy": "iserv-proxy", - "nix-tools-static": "nix-tools-static", "nixpkgs": [ "cardano-node", "nixpkgs" @@ -1007,11 +1006,11 @@ "stackage": "stackage" }, "locked": { - "lastModified": 1708911681, - "narHash": "sha256-QGkzPN1HUYxgMU2EwiwjMvR2gQF0ffUdxALq1+bOdcY=", + "lastModified": 1712278203, + "narHash": "sha256-L4eFUxnID2EYYtONE3fmZxPQdgPlB6XbAfIjlZi4c+U=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "5031fa0b8346fcc533c33073530ca87b8390add3", + "rev": "57938c23a4d40e5a746f05f2b71af11a7273a133", "type": "github" }, "original": { @@ -1029,8 +1028,8 @@ "cardano-shell": "cardano-shell_2", "flake-compat": "flake-compat_5", "ghc-8.6.5-iohk": "ghc-8.6.5-iohk_2", - "ghc98X": "ghc98X_2", - "ghc99": "ghc99_2", + "ghc910X": "ghc910X_2", + "ghc911": "ghc911_2", "hackage": "hackage", "hls-1.10": "hls-1.10_2", "hls-2.0": "hls-2.0_2", @@ -1039,10 +1038,11 @@ "hls-2.4": "hls-2.4_2", "hls-2.5": "hls-2.5_2", "hls-2.6": "hls-2.6_2", + "hls-2.7": "hls-2.7", + "hls-2.8": "hls-2.8", "hpc-coveralls": "hpc-coveralls_2", "hydra": "hydra_2", "iserv-proxy": "iserv-proxy_2", - "nix-tools-static": "nix-tools-static_2", "nixpkgs": [ "haskellNix", "nixpkgs-unstable" @@ -1059,11 +1059,11 @@ "stackage": "stackage_2" }, "locked": { - "lastModified": 1708563005, - "narHash": "sha256-RgC6n1kuSDo90Jy1ETlCGL3tr125WeWiDl6z6amEXoQ=", + "lastModified": 1716079818, + "narHash": "sha256-FvJI5v30jsQd2EhXJxCJlfhK/I0KOC+5SLSPMy5FdZ4=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "83acf6dc3fe8b3b9d218df2ee88ac875d1aeb801", + "rev": "5bc6f74e79cfc4dc8d644f984726c2d32ac399f7", "type": "github" }, "original": { @@ -1346,6 +1346,40 @@ "type": "github" } }, + "hls-2.7": { + "flake": false, + "locked": { + "lastModified": 1708965829, + "narHash": "sha256-LfJ+TBcBFq/XKoiNI7pc4VoHg4WmuzsFxYJ3Fu+Jf+M=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "50322b0a4aefb27adc5ec42f5055aaa8f8e38001", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.7.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.8": { + "flake": false, + "locked": { + "lastModified": 1715153580, + "narHash": "sha256-Vi/iUt2pWyUJlo9VrYgTcbRviWE0cFO6rmGi9rmALw0=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "dd1be1beb16700de59e0d6801957290bcf956a0a", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.8.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, "hpc-coveralls": { "flake": false, "locked": { @@ -1504,15 +1538,16 @@ "sodium": "sodium" }, "locked": { - "lastModified": 1709083850, - "narHash": "sha256-6DQ89ktt8rRVV1pXEyX2JwPjaqS0mQkelkmJmka04rg=", + "lastModified": 1715311504, + "narHash": "sha256-Jxma8/3WMb++2V1sp/iMF+6azv8cBR+ZbkLr61p2R24=", "owner": "input-output-hk", "repo": "iohk-nix", - "rev": "1c793a53ac0bd99b795c2180eb23d37e8389a74b", + "rev": "47727032a26ed92438afef6bdd45c95cd7399694", "type": "github" }, "original": { "owner": "input-output-hk", + "ref": "node-8.11", "repo": "iohk-nix", "type": "github" } @@ -1520,35 +1555,35 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1691634696, - "narHash": "sha256-MZH2NznKC/gbgBu8NgIibtSUZeJ00HTLJ0PlWKCBHb0=", - "ref": "hkm/remote-iserv", - "rev": "43a979272d9addc29fbffc2e8542c5d96e993d73", - "revCount": 14, - "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + "lastModified": 1708894040, + "narHash": "sha256-Rv+PajrnuJ6AeyhtqzMN+bcR8z9+aEnrUass+N951CQ=", + "owner": "stable-haskell", + "repo": "iserv-proxy", + "rev": "2f2a318fd8837f8063a0d91f329aeae29055fba9", + "type": "github" }, "original": { - "ref": "hkm/remote-iserv", - "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + "owner": "stable-haskell", + "ref": "iserv-syms", + "repo": "iserv-proxy", + "type": "github" } }, "iserv-proxy_2": { "flake": false, "locked": { - "lastModified": 1691634696, - "narHash": "sha256-MZH2NznKC/gbgBu8NgIibtSUZeJ00HTLJ0PlWKCBHb0=", - "ref": "hkm/remote-iserv", - "rev": "43a979272d9addc29fbffc2e8542c5d96e993d73", - "revCount": 14, - "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + "lastModified": 1708894040, + "narHash": "sha256-Rv+PajrnuJ6AeyhtqzMN+bcR8z9+aEnrUass+N951CQ=", + "owner": "stable-haskell", + "repo": "iserv-proxy", + "rev": "2f2a318fd8837f8063a0d91f329aeae29055fba9", + "type": "github" }, "original": { - "ref": "hkm/remote-iserv", - "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + "owner": "stable-haskell", + "ref": "iserv-syms", + "repo": "iserv-proxy", + "type": "github" } }, "lint-utils": { @@ -1762,40 +1797,6 @@ "type": "github" } }, - "nix-tools-static": { - "flake": false, - "locked": { - "lastModified": 1706266250, - "narHash": "sha256-9t+GRk3eO9muCtKdNAwBtNBZ5dH1xHcnS17WaQyftwA=", - "owner": "input-output-hk", - "repo": "haskell-nix-example", - "rev": "580cb6db546a7777dad3b9c0fa487a366c045c4e", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "ref": "nix", - "repo": "haskell-nix-example", - "type": "github" - } - }, - "nix-tools-static_2": { - "flake": false, - "locked": { - "lastModified": 1706266250, - "narHash": "sha256-9t+GRk3eO9muCtKdNAwBtNBZ5dH1xHcnS17WaQyftwA=", - "owner": "input-output-hk", - "repo": "haskell-nix-example", - "rev": "580cb6db546a7777dad3b9c0fa487a366c045c4e", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "ref": "nix", - "repo": "haskell-nix-example", - "type": "github" - } - }, "nix2container": { "inputs": { "flake-utils": "flake-utils_2", @@ -2836,11 +2837,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1708906175, - "narHash": "sha256-KJDF0CO077Jx4GjjPK6pNkx6NkY7p1x5RMPfaIe8nl4=", + "lastModified": 1712276009, + "narHash": "sha256-KlRJ+CGXRueyz2VRLDwra5JBNaI2GkltNJAjHa7fowE=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "bfa4778050cf69fe50f91d39dcefbb9005d6d0d0", + "rev": "758035379a5ac4390879e4cd5164abe0c96fcea7", "type": "github" }, "original": { @@ -2852,11 +2853,11 @@ "stackage_2": { "flake": false, "locked": { - "lastModified": 1708560571, - "narHash": "sha256-/ZxWtAaoskXxeE79aA/K5PirGFUsqdu2TLRLskDj1js=", + "lastModified": 1716077955, + "narHash": "sha256-YD9MJWQ+NUoCZHJ5EzCl9/F0flNR71oGz4tUSJMdMWY=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "e0cb41371d5b1e76cddb4e25d748fdb87c176176", + "rev": "47f60b206c19c30ae5c3e5d7c276ff91620adf1c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index fbc505fc62d..5e6f932b8a7 100644 --- a/flake.nix +++ b/flake.nix @@ -18,7 +18,7 @@ url = "github:cardano-scaling/haskell-language-server?ref=2.6-patched"; flake = false; }; - cardano-node.url = "github:intersectmbo/cardano-node/8.9.0"; + cardano-node.url = "github:intersectmbo/cardano-node/8.11.0-pre"; mithril.url = "github:input-output-hk/mithril/2418.1"; nix-npm-buildpackage.url = "github:serokell/nix-npm-buildpackage"; }; diff --git a/hydra-cardano-api/hydra-cardano-api.cabal b/hydra-cardano-api/hydra-cardano-api.cabal index 18e008c09e3..f003ee5fd2f 100644 --- a/hydra-cardano-api/hydra-cardano-api.cabal +++ b/hydra-cardano-api/hydra-cardano-api.cabal @@ -82,7 +82,7 @@ library , base >=4.16 , base16-bytestring , bytestring - , cardano-api ^>=8.44 + , cardano-api ^>=8.46 , cardano-api-classy , cardano-binary , cardano-crypto-class diff --git a/hydra-cardano-api/src/Hydra/Cardano/Api/Tx.hs b/hydra-cardano-api/src/Hydra/Cardano/Api/Tx.hs index a38accdc1af..49202994012 100644 --- a/hydra-cardano-api/src/Hydra/Cardano/Api/Tx.hs +++ b/hydra-cardano-api/src/Hydra/Cardano/Api/Tx.hs @@ -10,7 +10,7 @@ import Cardano.Ledger.Alonzo.TxAuxData (translateAlonzoTxAuxData) import Cardano.Ledger.Alonzo.TxWits qualified as Ledger import Cardano.Ledger.Api ( AlonzoPlutusPurpose (..), - AsIndex (..), + AsIx (..), ConwayPlutusPurpose (..), EraTx (mkBasicTx), addrTxOutL, @@ -143,13 +143,13 @@ convertConwayTx = $ Map.toList redeemerMap translatePlutusPurpose :: - Conway.ConwayPlutusPurpose Ledger.AsIndex (Ledger.ConwayEra StandardCrypto) -> - Maybe (Ledger.AlonzoPlutusPurpose Ledger.AsIndex (Ledger.BabbageEra StandardCrypto)) + Conway.ConwayPlutusPurpose Ledger.AsIx (Ledger.ConwayEra StandardCrypto) -> + Maybe (Ledger.AlonzoPlutusPurpose Ledger.AsIx (Ledger.BabbageEra StandardCrypto)) translatePlutusPurpose = \case - ConwaySpending (AsIndex ix) -> Just $ AlonzoSpending (AsIndex ix) - ConwayMinting (AsIndex ix) -> Just $ AlonzoMinting (AsIndex ix) - ConwayCertifying (AsIndex ix) -> Just $ AlonzoCertifying (AsIndex ix) - ConwayRewarding (AsIndex ix) -> Just $ AlonzoRewarding (AsIndex ix) + ConwaySpending (AsIx ix) -> Just $ AlonzoSpending (AsIx ix) + ConwayMinting (AsIx ix) -> Just $ AlonzoMinting (AsIx ix) + ConwayCertifying (AsIx ix) -> Just $ AlonzoCertifying (AsIx ix) + ConwayRewarding (AsIx ix) -> Just $ AlonzoRewarding (AsIx ix) ConwayVoting{} -> Nothing ConwayProposing{} -> Nothing diff --git a/hydra-cardano-api/src/Hydra/Cardano/Api/TxBody.hs b/hydra-cardano-api/src/Hydra/Cardano/Api/TxBody.hs index 54c13e21d3c..f83a35d43f2 100644 --- a/hydra-cardano-api/src/Hydra/Cardano/Api/TxBody.hs +++ b/hydra-cardano-api/src/Hydra/Cardano/Api/TxBody.hs @@ -3,7 +3,7 @@ module Hydra.Cardano.Api.TxBody where import Hydra.Cardano.Api.Prelude import Cardano.Ledger.Alonzo.TxWits qualified as Ledger -import Cardano.Ledger.Api (AlonzoPlutusPurpose (..), AsIndex, AsItem (..), PlutusPurpose) +import Cardano.Ledger.Api (AlonzoPlutusPurpose (..), AsItem (..), AsIx, PlutusPurpose) import Cardano.Ledger.Babbage.Core (redeemerPointer) import Cardano.Ledger.BaseTypes (strictMaybeToMaybe) import Cardano.Ledger.Core qualified as Ledger @@ -53,7 +53,7 @@ findScriptMinting (getTxBody -> ShelleyTxBody _ _ scripts _ _ _) pid = do lookupRedeemer :: Plutus.FromData a => - PlutusPurpose AsIndex LedgerEra -> + PlutusPurpose AsIx LedgerEra -> TxBodyScriptData Era -> Maybe a lookupRedeemer ptr scriptData = do diff --git a/hydra-cluster/config/devnet/genesis-conway.json b/hydra-cluster/config/devnet/genesis-conway.json index 4410964d59f..6bf42ed6590 100644 --- a/hydra-cluster/config/devnet/genesis-conway.json +++ b/hydra-cluster/config/devnet/genesis-conway.json @@ -25,15 +25,18 @@ "govActionDeposit": 1000000000, "dRepDeposit": 2000000, "dRepActivity": 20, + "minFeeRefScriptCostPerByte": 0, "constitution": { "anchor": { "url": "", "dataHash": "0000000000000000000000000000000000000000000000000000000000000000" } }, + "plutusV3CostModel": [], "committee": { "members": { }, - "quorum": 0 + "quorum": 0, + "threshold": 0 } } diff --git a/hydra-cluster/test/Test/CardanoNodeSpec.hs b/hydra-cluster/test/Test/CardanoNodeSpec.hs index 970508038a7..20e3ad0d041 100644 --- a/hydra-cluster/test/Test/CardanoNodeSpec.hs +++ b/hydra-cluster/test/Test/CardanoNodeSpec.hs @@ -23,7 +23,7 @@ spec = do -- false positives test errors in case someone uses an "untested" / -- different than in shell.nix version of cardano-node and cardano-cli. it "has expected cardano-node version available" $ - getCardanoNodeVersion >>= (`shouldContain` "8.9.0") + getCardanoNodeVersion >>= (`shouldContain` "8.11.0") around (failAfter 5 . setupTracerAndTempDir) $ do it "withCardanoNodeDevnet does start a block-producing devnet within 5 seconds" $ \(tr, tmp) -> diff --git a/hydra-node/hydra-node.cabal b/hydra-node/hydra-node.cabal index 83abf10e6b1..18216d06bfe 100644 --- a/hydra-node/hydra-node.cabal +++ b/hydra-node/hydra-node.cabal @@ -151,9 +151,9 @@ library , optparse-applicative , ouroboros-consensus , ouroboros-consensus-cardano - , ouroboros-network-api >=0.1.0.0 - , ouroboros-network-framework >=0.3.0.0 - , ouroboros-network-protocols >=0.3.0.0 + , ouroboros-network-api ^>=0.7.1 + , ouroboros-network-framework + , ouroboros-network-protocols ^>=0.8 , plutus-core >=1.21 , plutus-ledger-api >=1.21 , prometheus @@ -368,7 +368,7 @@ test-suite tests , plutus-tx , pretty-simple , QuickCheck - , quickcheck-dynamic >=3.3.1 && <3.4 + , quickcheck-dynamic >=3.3.1 , quickcheck-instances , random , regex-tdfa diff --git a/hydra-node/src/Hydra/Chain/Direct/Tx.hs b/hydra-node/src/Hydra/Chain/Direct/Tx.hs index fa6173f963d..f71716645b7 100644 --- a/hydra-node/src/Hydra/Chain/Direct/Tx.hs +++ b/hydra-node/src/Hydra/Chain/Direct/Tx.hs @@ -13,12 +13,14 @@ import Hydra.Cardano.Api import Hydra.Prelude import Cardano.Api.UTxO qualified as UTxO +import Cardano.Ledger.Alonzo.Core (AsIxItem (..)) +import Cardano.Ledger.Plutus.Data (Data) import Cardano.Ledger.Alonzo.Scripts (ExUnits (..)) +import Cardano.Ledger.Alonzo.Tx (AlonzoTx) import Cardano.Ledger.Alonzo.TxAuxData (AlonzoTxAuxData (..)) import Cardano.Ledger.Api ( AlonzoPlutusPurpose (..), - AsIndex (..), - AsItem (..), + AsIx (..), EraTxAuxData (hashTxAuxData), Redeemers (..), auxDataHashTxBodyL, @@ -35,6 +37,7 @@ import Cardano.Ledger.Api ( ) import Cardano.Ledger.Babbage.Core (redeemerPointerInverse) import Cardano.Ledger.BaseTypes (StrictMaybe (..)) +import Cardano.Ledger.TxIn qualified import Control.Lens ((.~), (<>~), (^.)) import Data.Aeson qualified as Aeson import Data.ByteString qualified as BS @@ -78,6 +81,7 @@ import Hydra.Party (Party, partyFromChain, partyToChain) import Hydra.Plutus.Extras (posixFromUTCTime, posixToUTCTime) import Hydra.Plutus.Orphans () import Hydra.Snapshot (Snapshot (..), SnapshotNumber, fromChainSnapshot) +import Ouroboros.Consensus.Cardano.Block (StandardBabbage) import PlutusLedgerApi.V2 (CurrencySymbol (CurrencySymbol), fromBuiltin, getPubKeyHash, toBuiltin) import PlutusLedgerApi.V2 qualified as Plutus import Test.QuickCheck (vectorOf) @@ -259,6 +263,10 @@ commitTx networkId scriptRegistry headId party commitBlueprintTx (initialInput, & bodyTxL . mintTxBodyL .~ mempty & addMetadata (mkHydraHeadV1TxName "CommitTx") where + addMetadata :: + TxMetadata -> + AlonzoTx StandardBabbage -> + AlonzoTx StandardBabbage addMetadata (TxMetadata newMetadata) tx = let newMetadataMap = toShelleyMetadata newMetadata @@ -272,6 +280,9 @@ commitTx networkId scriptRegistry headId party commitBlueprintTx (initialInput, & auxDataTxL .~ SJust newAuxData & bodyTxL . auxDataHashTxBodyL .~ SJust (hashTxAuxData newAuxData) + spendFromInitial :: + AlonzoTx StandardBabbage -> + AlonzoTx StandardBabbage spendFromInitial tx = let newRedeemers = resolveSpendingRedeemers tx @@ -283,6 +294,10 @@ commitTx networkId scriptRegistry headId party commitBlueprintTx (initialInput, & witsTxL . rdmrsTxWitsL .~ mkRedeemers newRedeemers newInputs -- Make redeemers (with zeroed units) from a TxIn -> Data map and a set of transaction inputs + mkRedeemers :: + Map (Cardano.Ledger.TxIn.TxIn StandardCrypto) (Data StandardBabbage) -> + Set (Cardano.Ledger.TxIn.TxIn StandardCrypto) -> + Redeemers StandardBabbage mkRedeemers resolved inputs = Redeemers . Map.fromList $ foldl' @@ -291,18 +306,21 @@ commitTx networkId scriptRegistry headId party commitBlueprintTx (initialInput, in case Map.lookup txin resolved of Nothing -> newRedeemerData Just d -> - (AlonzoSpending (AsIndex ix), (d, ExUnits 0 0)) : newRedeemerData + (AlonzoSpending (AsIx ix), (d, ExUnits 0 0)) : newRedeemerData ) [] inputs -- Create a TxIn -> Data map of all spending redeemers + resolveSpendingRedeemers :: + AlonzoTx StandardBabbage -> + Map (Cardano.Ledger.TxIn.TxIn StandardCrypto) (Data StandardBabbage) resolveSpendingRedeemers tx = Map.foldMapWithKey ( \p (d, _ex) -> -- XXX: Should soon be available through cardano-ledger-api again case redeemerPointerInverse (tx ^. bodyTxL) p of - SJust (AlonzoSpending (AsItem txIn)) -> Map.singleton txIn d + SJust (AlonzoSpending (AsIxItem _ txIn)) -> Map.singleton txIn d _ -> mempty ) (unRedeemers $ tx ^. witsTxL . rdmrsTxWitsL) diff --git a/hydra-node/src/Hydra/Chain/Direct/Wallet.hs b/hydra-node/src/Hydra/Chain/Direct/Wallet.hs index 230aab8a788..0fc6092e052 100644 --- a/hydra-node/src/Hydra/Chain/Direct/Wallet.hs +++ b/hydra-node/src/Hydra/Chain/Direct/Wallet.hs @@ -14,10 +14,10 @@ import Cardano.Ledger.Alonzo.Plutus.Context (ContextError) import Cardano.Ledger.Alonzo.Scripts ( AlonzoEraScript (..), AlonzoPlutusPurpose (AlonzoSpending), - AsIndex (..), + AsIx (..), ExUnits (ExUnits), plutusScriptLanguage, - unAsIndex, + unAsIx, ) import Cardano.Ledger.Alonzo.TxWits ( AlonzoTxWits (..), @@ -239,7 +239,7 @@ data ErrCoverFee = ErrNotEnoughFunds ChangeError | ErrNoFuelUTxOFound | ErrUnknownInput {input :: TxIn} - | ErrScriptExecutionFailed {scriptFailure :: (PlutusPurpose AsIndex LedgerEra, TransactionScriptFailure LedgerEra)} + | ErrScriptExecutionFailed {scriptFailure :: (PlutusPurpose AsIx LedgerEra, TransactionScriptFailure LedgerEra)} | ErrTranslationError (ContextError LedgerEra) deriving stock (Show) @@ -307,7 +307,7 @@ coverFee_ pparams systemStart epochInfo lookupUTxO walletUTxO partialTx@Babbage. -- Compute fee using a body with selected txOut to pay fees (= full change) -- and an aditional witness (we will sign this tx later) - let fee = estimateMinFeeTx pparams costingTx additionalWitnesses 0 + let fee = estimateMinFeeTx pparams costingTx additionalWitnesses 0 0 costingTx = unbalancedTx & bodyTxL . outputsTxBodyL %~ (|> feeTxOut) @@ -366,7 +366,7 @@ coverFee_ pparams systemStart epochInfo lookupUTxO walletUTxO partialTx@Babbage. changeOut = totalIn <> invert totalOut refScript = SNothing - adjustRedeemers :: Set TxIn -> Set TxIn -> Map (PlutusPurpose AsIndex LedgerEra) ExUnits -> Redeemers LedgerEra -> Redeemers LedgerEra + adjustRedeemers :: Set TxIn -> Set TxIn -> Map (PlutusPurpose AsIx LedgerEra) ExUnits -> Redeemers LedgerEra -> Redeemers LedgerEra adjustRedeemers initialInputs finalInputs estimatedCosts (Redeemers initialRedeemers) = Redeemers $ Map.fromList $ map adjustOne $ Map.toList initialRedeemers where @@ -377,12 +377,12 @@ coverFee_ pparams systemStart epochInfo lookupUTxO walletUTxO partialTx@Babbage. adjustOne (ptr, (d, _exUnits)) = case ptr of AlonzoSpending idx - | fromIntegral (unAsIndex idx) `elem` differences -> - (AlonzoSpending (AsIndex (unAsIndex idx + 1)), (d, executionUnitsFor ptr)) + | fromIntegral (unAsIx idx) `elem` differences -> + (AlonzoSpending (AsIx (unAsIx idx + 1)), (d, executionUnitsFor ptr)) _ -> (ptr, (d, executionUnitsFor ptr)) - executionUnitsFor :: PlutusPurpose AsIndex LedgerEra -> ExUnits + executionUnitsFor :: PlutusPurpose AsIx LedgerEra -> ExUnits executionUnitsFor ptr = let ExUnits maxMem maxCpu = pparams ^. ppMaxTxExUnitsL ExUnits totalMem totalCpu = foldMap identity estimatedCosts @@ -418,7 +418,7 @@ estimateScriptsCost :: Map TxIn TxOut -> -- | The pre-constructed transaction Babbage.AlonzoTx LedgerEra -> - Either ErrCoverFee (Map (PlutusPurpose AsIndex LedgerEra) ExUnits) + Either ErrCoverFee (Map (PlutusPurpose AsIx LedgerEra) ExUnits) estimateScriptsCost pparams systemStart epochInfo utxo tx = do case result of Left translationError -> diff --git a/hydra-node/src/Hydra/Ledger/Cardano/Evaluate.hs b/hydra-node/src/Hydra/Ledger/Cardano/Evaluate.hs index 486e6e19bdb..7dd3a0a2c52 100644 --- a/hydra-node/src/Hydra/Ledger/Cardano/Evaluate.hs +++ b/hydra-node/src/Hydra/Ledger/Cardano/Evaluate.hs @@ -62,6 +62,7 @@ import Hydra.Cardano.Api ( import Hydra.Cardano.Api.Pretty (renderTxWithUTxO) import Hydra.ContestationPeriod (ContestationPeriod (UnsafeContestationPeriod)) import Hydra.Ledger.Cardano.Time (slotNoFromUTCTime, slotNoToUTCTime) +import Ouroboros.Consensus.Block (GenesisWindow (..)) import Ouroboros.Consensus.Cardano.Block (CardanoEras) import Ouroboros.Consensus.HardFork.History ( Bound (Bound, boundEpoch, boundSlot, boundTime), @@ -218,7 +219,7 @@ prepareTxScripts tx utxo = do Right x -> pure x -- Fully applied UPLC programs which we could run using the cekMachine - programs <- forM results $ \(PlutusWithContext protocolVersion script arguments _exUnits _costModel) -> do + programs <- forM results $ \(PlutusWithContext protocolVersion script _ arguments _exUnits _costModel) -> do (PlutusRunnable x) <- case script of Right runnable -> pure runnable @@ -319,6 +320,7 @@ eraHistoryWithHorizonAt slotNo@(SlotNo n) = , -- NOTE: unused if the 'eraEnd' is already defined, but would be used to -- extend the last era accordingly in the real cardano-node eraSafeZone = UnsafeIndefiniteSafeZone + , eraGenesisWin = GenesisWindow 1 } eraHistoryWithoutHorizon :: EraHistory @@ -341,6 +343,7 @@ eraHistoryWithoutHorizon = , -- NOTE: unused if the 'eraEnd' is already defined, but would be used to -- extend the last era accordingly in the real cardano-node eraSafeZone = UnsafeIndefiniteSafeZone + , eraGenesisWin = GenesisWindow 1 } epochSize :: EpochSize diff --git a/hydra-plutus-extras/src/Hydra/Plutus/Orphans.hs b/hydra-plutus-extras/src/Hydra/Plutus/Orphans.hs index e6476a718b1..95a9faeaec0 100644 --- a/hydra-plutus-extras/src/Hydra/Plutus/Orphans.hs +++ b/hydra-plutus-extras/src/Hydra/Plutus/Orphans.hs @@ -12,7 +12,7 @@ import Data.ByteString qualified as BS import Data.ByteString.Base16 qualified as Base16 import PlutusLedgerApi.V2 (CurrencySymbol, POSIXTime (..), PubKeyHash (..), TokenName, TxId (..), TxOutRef (..), UpperBound, Value, upperBound) import PlutusTx.AssocMap qualified as AssocMap -import PlutusTx.Prelude (BuiltinByteString, fromBuiltin, toBuiltin) +import PlutusTx.Prelude (BuiltinByteString, Eq, fromBuiltin, toBuiltin) import Test.QuickCheck (choose, vectorOf) import Test.QuickCheck.Instances.ByteString () @@ -31,8 +31,8 @@ instance Arbitrary Value where arbitrary = genericArbitrary shrink = genericShrink -instance (Arbitrary k, Arbitrary v) => Arbitrary (AssocMap.Map k v) where - arbitrary = AssocMap.fromList <$> arbitrary +instance (PlutusTx.Prelude.Eq k, Arbitrary k, Arbitrary v) => Arbitrary (AssocMap.Map k v) where + arbitrary = AssocMap.safeFromList <$> arbitrary instance Arbitrary POSIXTime where arbitrary = POSIXTime <$> arbitrary diff --git a/plutus-cbor/bench/Main.hs b/plutus-cbor/bench/Main.hs index 105d735739b..ac0b14039ef 100644 --- a/plutus-cbor/bench/Main.hs +++ b/plutus-cbor/bench/Main.hs @@ -133,16 +133,16 @@ genValue = do assetName <- genTokenName pure $ Plutus.Value $ - Plutus.Map.fromList - [(policyId, Plutus.Map.fromList [(assetName, n)])] + Plutus.Map.safeFromList + [(policyId, Plutus.Map.safeFromList [(assetName, n)])] genAdaOnlyValue :: Gen Plutus.Value genAdaOnlyValue = do n <- genAssetQuantity pure $ Plutus.Value $ - Plutus.Map.fromList - [(Plutus.adaSymbol, Plutus.Map.fromList [(Plutus.adaToken, n)])] + Plutus.Map.safeFromList + [(Plutus.adaSymbol, Plutus.Map.safeFromList [(Plutus.adaToken, n)])] genAssetQuantity :: Gen Integer genAssetQuantity = choose (1, 4_294_967_296) -- NOTE: 2**32 diff --git a/plutus-cbor/exe/encoding-cost/Main.hs b/plutus-cbor/exe/encoding-cost/Main.hs index ea4beb7abf3..bb1dcb52ec7 100644 --- a/plutus-cbor/exe/encoding-cost/Main.hs +++ b/plutus-cbor/exe/encoding-cost/Main.hs @@ -119,16 +119,16 @@ genValue = do assetName <- genTokenName pure $ Plutus.Value $ - Plutus.Map.fromList - [(policyId, Plutus.Map.fromList [(assetName, n)])] + Plutus.Map.safeFromList + [(policyId, Plutus.Map.safeFromList [(assetName, n)])] genAdaOnlyValue :: Gen Plutus.Value genAdaOnlyValue = do n <- genAssetQuantity pure $ Plutus.Value $ - Plutus.Map.fromList - [(Plutus.adaSymbol, Plutus.Map.fromList [(Plutus.adaToken, n)])] + Plutus.Map.safeFromList + [(Plutus.adaSymbol, Plutus.Map.safeFromList [(Plutus.adaToken, n)])] genAssetQuantity :: Gen Integer genAssetQuantity = choose (1, 4_294_967_296) -- NOTE: 2**32 diff --git a/plutus-cbor/test/Plutus/Codec/CBOR/EncodingSpec.hs b/plutus-cbor/test/Plutus/Codec/CBOR/EncodingSpec.hs index 386f4794187..13f1b4eb493 100644 --- a/plutus-cbor/test/Plutus/Codec/CBOR/EncodingSpec.hs +++ b/plutus-cbor/test/Plutus/Codec/CBOR/EncodingSpec.hs @@ -185,7 +185,7 @@ genSomeValue = encodeMap (\(SomeValue k _ _ encodeKey) -> encodeKey k) (\(SomeValue v _ _ encodeValue) -> encodeValue v) - . Plutus.Map.fromList + . Plutus.Map.safeFromList return $ SomeValue val shrinkMap encodeCborg encodeOurs genSomeMapIndef :: Int -> Gen SomeValue @@ -206,7 +206,7 @@ genSomeValue = encodeMapIndef (\(SomeValue k _ _ encodeKey) -> encodeKey k) (\(SomeValue v _ _ encodeValue) -> encodeValue v) - . Plutus.Map.fromList + . Plutus.Map.safeFromList return $ SomeValue val shrinkMap encodeCborg encodeOurs genSomeTag :: Gen SomeValue