diff --git a/cabal.project b/cabal.project index 40bb72ea8d5..f1ec8b642e7 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-07-19T19:07:04Z - , cardano-haskell-packages 2024-07-19T19:04:02Z + , hackage.haskell.org 2024-09-23T15:45:50Z + , cardano-haskell-packages 2024-09-20T19:39:13Z packages: hydra-prelude diff --git a/demo/alice-blueprint-commit.hs b/demo/alice-blueprint-commit.hs new file mode 100755 index 00000000000..7109c897644 --- /dev/null +++ b/demo/alice-blueprint-commit.hs @@ -0,0 +1,134 @@ +{-# LANGUAGE ExtendedDefaultRules #-} +{-# LANGUAGE OverloadedStrings #-} + +import Control.Lens (asIndex, to, (&), (^.), (^?)) +import Data.Aeson +import qualified Data.Aeson.Key as Key +import Data.Aeson.Lens +import Data.ByteString.Lazy (ByteString) +import qualified Data.ByteString.Lazy as LBS +import Data.Maybe (fromJust) +import Data.String +import Data.Text (Text) +import qualified Data.Text.Lazy as Text +import Data.Text.Lazy.Encoding (decodeLatin1) +import Shh + +getAddress :: IO ByteString +getAddress = do + exe + "cardano-cli" + "address" + "build" + "--payment-verification-key-file" + "devnet/credentials/alice-funds.vk" + "--testnet-magic" + "42" + |> capture + +getUTxO :: ByteString -> IO (Either String Value) +getUTxO address = do + k <- + exe + "cardano-cli" + "query" + "utxo" + "--socket-path" + "devnet/node.socket" + "--address" + address + "--testnet-magic" + "42" + "--output-json" + |> capture + pure $ eitherDecode k + +buildTransaction :: ByteString -> ByteString -> IO (Either String Value) +buildTransaction i o = do + x <- + exe + "cardano-cli" + "conway" + "transaction" + "build-raw" + "--tx-in" + i + "--tx-out" + (o <> "+5000000") + "--fee" + "0" + "--out-file" + "/dev/stdout" + |> capture + pure $ eitherDecode x + +blueprintTx :: Text -> Value -> Text -> Value +blueprintTx address utxo cborHex = + object + [ "blueprintTx" + .= object + [ "cborHex" .= String cborHex + , "description" .= "" + , "type" .= "Tx ConwayEra" + ] + , "utxo" .= utxo + ] + +decodeTxFile :: IO (Either String Value) +decodeTxFile = do + x <- LBS.readFile "tx.json" + pure $ eitherDecode x + +curlCommitRequest :: IO ByteString +curlCommitRequest = + exe + "curl" + "-X" + "POST" + "127.0.0.1:4001/commit" + "--data" + "@commit-request.json" + |> capture + +signTransaction :: IO () +signTransaction = + exe + "cardano-cli" + "transaction" + "sign" + "--tx-file" + "commit-tx.json" + "--signing-key-file" + "devnet/credentials/alice-funds.sk" + "--out-file" + "signed-tx.json" + +submitTransaction :: IO () +submitTransaction = + exe + "cardano-cli" + "transaction" + "submit" + "--tx-file" + "signed-tx.json" + "--socket-path" + "devnet/node.socket" + "--testnet-magic" + "42" + +main = do + address <- getAddress + utxo <- either error id <$> getUTxO address + let utxoKey = utxo ^. members . asIndex + tx <- either error id <$> buildTransaction (Data.String.fromString . Key.toString $ utxoKey) address + let cborHex = tx ^? key "cborHex" + let (String cborHexBS) = fromJust cborHex + encodeFile "commit-request.json" $ + blueprintTx + (Text.toStrict $ decodeLatin1 address) + utxo + cborHexBS + commitTx <- curlCommitRequest + LBS.writeFile "commit-tx.json" commitTx + signTransaction + submitTransaction diff --git a/flake.lock b/flake.lock index 8436c1fa0b6..1532ba72750 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1721391352, - "narHash": "sha256-scqGnAT3tofRQUb9av5+lhGnpK03HzSKMmKk80wDb2A=", + "lastModified": 1727170555, + "narHash": "sha256-kxB/xjSjqym5kKYDw/CZMb6O1OfCVWRjjsuqyWABd0w=", "owner": "IntersectMBO", "repo": "cardano-haskell-packages", - "rev": "ef6499225aab60d39690732fac110377ff8b8324", + "rev": "d8beaf7e30330f8a70e626f63a5b47d1999fbf4b", "type": "github" }, "original": { @@ -832,11 +832,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1720572067, - "narHash": "sha256-BzF/jCFF/G1woW9liObR2g8oQIv40rqudjjouRZd790=", + "lastModified": 1727224042, + "narHash": "sha256-bobZR+mTiX2UkrjIL5tNIK38uz/835TqXa2HYLBc2IA=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "2069cd9298dd9248e8d1312e5dbcd4b0b30dcaa3", + "rev": "c06d89f727acc16e5261e2d7832cee5473e5e63d", "type": "github" }, "original": { @@ -952,16 +952,17 @@ "nixpkgs-2211": "nixpkgs-2211_2", "nixpkgs-2305": "nixpkgs-2305_2", "nixpkgs-2311": "nixpkgs-2311_2", + "nixpkgs-2405": "nixpkgs-2405", "nixpkgs-unstable": "nixpkgs-unstable_2", "old-ghc-nix": "old-ghc-nix_2", "stackage": "stackage_2" }, "locked": { - "lastModified": 1720572637, - "narHash": "sha256-ObY6AcToX2JvH8DpV/0ytAGGXRng4xy05kInNsGrXZQ=", + "lastModified": 1727225466, + "narHash": "sha256-NFhTqLbfvvAmM2JDTMHtWNN137fBMmP5bncxNT/9eY8=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "cb7d4670d16190ce6154e941c21c9b1dd27f16c7", + "rev": "e1360464083ee3e22cbbba660b70ff41734a1cba", "type": "github" }, "original": { @@ -1335,16 +1336,16 @@ "hls-2.9_2": { "flake": false, "locked": { - "lastModified": 1718469202, - "narHash": "sha256-THXSz+iwB1yQQsr/PY151+2GvtoJnTIB2pIQ4OzfjD4=", + "lastModified": 1720003792, + "narHash": "sha256-qnDx8Pk0UxtoPr7BimEsAZh9g2WuTuMB/kGqnmdryKs=", "owner": "haskell", "repo": "haskell-language-server", - "rev": "40891bccb235ebacce020b598b083eab9dda80f1", + "rev": "0c1817cb2babef0765e4e72dd297c013e8e3d12b", "type": "github" }, "original": { "owner": "haskell", - "ref": "2.9.0.0", + "ref": "2.9.0.1", "repo": "haskell-language-server", "type": "github" } @@ -2030,11 +2031,11 @@ }, "nixpkgs-2305_2": { "locked": { - "lastModified": 1701362232, - "narHash": "sha256-GVdzxL0lhEadqs3hfRLuj+L1OJFGiL/L7gCcelgBlsw=", + "lastModified": 1705033721, + "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d2332963662edffacfddfad59ff4f709dde80ffe", + "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", "type": "github" }, "original": { @@ -2062,11 +2063,11 @@ }, "nixpkgs-2311_2": { "locked": { - "lastModified": 1701386440, - "narHash": "sha256-xI0uQ9E7JbmEy/v8kR9ZQan6389rHug+zOtZeZFiDJk=", + "lastModified": 1719957072, + "narHash": "sha256-gvFhEf5nszouwLAkT9nWsDzocUTqLWHuL++dvNjMp9I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "293822e55ec1872f715a66d0eda9e592dc14419f", + "rev": "7144d6241f02d171d25fba3edeaf15e0f2592105", "type": "github" }, "original": { @@ -2076,6 +2077,22 @@ "type": "github" } }, + "nixpkgs-2405": { + "locked": { + "lastModified": 1720122915, + "narHash": "sha256-Nby8WWxj0elBu1xuRaUcRjPi/rU3xVbkAt2kj4QwX2U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "835cf2d3f37989c5db6585a28de967a667a75fb1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-24.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-lib": { "locked": { "lastModified": 1719876945, @@ -2162,17 +2179,17 @@ }, "nixpkgs-unstable_2": { "locked": { - "lastModified": 1694822471, - "narHash": "sha256-6fSDCj++lZVMZlyqOe9SIOL8tYSBz1bI8acwovRwoX8=", + "lastModified": 1720181791, + "narHash": "sha256-i4vJL12/AdyuQuviMMd1Hk2tsGt02hDNhA0Zj1m16N8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", + "rev": "4284c2b73c8bce4b46a6adf23e16d9e2ec8da4bb", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", - "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", "type": "github" } }, @@ -2580,11 +2597,11 @@ "stackage_2": { "flake": false, "locked": { - "lastModified": 1720571013, - "narHash": "sha256-k/I+CPMX24J6Gi1/pyJPLloadTj8nO95H0RaIRKoo0c=", + "lastModified": 1727223062, + "narHash": "sha256-j3hoqYsoPWtxLrgYfLEfL0AF2MbXmQszkRIonL2vl0M=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "2d54320b933f0ab31446bd12742874b6640053ad", + "rev": "543f929fa829ba51d63e8a7d14f84d0be819f2d4", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 5b4a6f0d6cc..1b99aa4fde0 100644 --- a/flake.nix +++ b/flake.nix @@ -124,6 +124,13 @@ value = addWerror v; }) x.components."${y}") [ "benchmarks" "exes" "sublibs" "tests" ]); + alice-blueprint-commit = pkgs.writers.writeHaskellBin + "alice-blueprint-commit" + { + libraries = + with pkgs.haskellPackages; + [ aeson text bytestring lens lens-aeson shh ]; + } ''${builtins.readFile demo/alice-blueprint-commit.hs}''; in { legacyPackages = pkgs // hsPkgs; @@ -132,6 +139,7 @@ hydraPackages // (if pkgs.stdenv.isLinux then (prefixAttrs "docker-" hydraImages) else { }) // { spec = inputs.hydra-spec.packages.${system}.default; + alice-blueprint-commit = alice-blueprint-commit; }; process-compose."demo" = import ./nix/hydra/demo.nix { inherit system pkgs inputs self; @@ -149,7 +157,7 @@ pkgs.nixpkgs-fmt pkgs.fourmolu ]; - treefmt = pkgs.treefmt; + treefmt = pkgsLatest.treefmt; }; } // lib.attrsets.mergeAttrsList (map (x: componentsToWerrors x hsPkgs.${x}) [ "hydra-cardano-api" @@ -167,7 +175,8 @@ ]); devShells = import ./nix/hydra/shell.nix { - inherit inputs pkgs hsPkgs system compiler pkgsLatest; + inherit inputs pkgs hsPkgs system pkgsLatest; + ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler}; }; }; }; diff --git a/hydra-plutus/hydra-plutus.cabal b/hydra-plutus/hydra-plutus.cabal index 1962eaa0f2e..11b44fdaf68 100644 --- a/hydra-plutus/hydra-plutus.cabal +++ b/hydra-plutus/hydra-plutus.cabal @@ -71,10 +71,10 @@ library , hydra-cardano-api , hydra-plutus-extras , hydra-prelude - , plutus-core >=1.21 - , plutus-ledger-api >=1.21 - , plutus-tx >=1.21 - , plutus-tx-plugin >=1.21 + , plutus-core ^>=1.30 + , plutus-ledger-api ^>=1.30 + , plutus-tx ^>=1.30 + , plutus-tx-plugin ^>=1.30 , QuickCheck , serialise , template-haskell diff --git a/nix/hydra/shell.nix b/nix/hydra/shell.nix index 3569f1547b4..5b71876a0fc 100644 --- a/nix/hydra/shell.nix +++ b/nix/hydra/shell.nix @@ -6,7 +6,7 @@ , inputs , system , pkgs -, compiler +, ghc , pkgsLatest }: let @@ -90,7 +90,7 @@ let name = "hydra-node-cabal-shell"; buildInputs = libs ++ [ - hsPkgs.ghc + ghc pkgs.cabal-install pkgs.pkg-config ] ++ buildInputs;