diff --git a/lib/core/src/Cardano/DB/Sqlite.hs b/lib/core/src/Cardano/DB/Sqlite.hs index 61cfb51d735..b17fee96f9b 100644 --- a/lib/core/src/Cardano/DB/Sqlite.hs +++ b/lib/core/src/Cardano/DB/Sqlite.hs @@ -62,7 +62,7 @@ import Data.Maybe import Data.Text ( Text ) import Database.Persist.Sql - ( LogFunc, Migration, close', runMigrationSilent, runSqlConn ) + ( LogFunc, Migration, close', runMigrationQuiet, runSqlConn ) import Database.Persist.Sqlite ( SqlBackend, SqlPersistT, mkSqliteConnectionInfo, wrapConnectionInfo ) import Database.Sqlite @@ -152,7 +152,7 @@ startSqliteBackend logConfig migrateAll trace fp = do observe = bracketObserveIO logConfig traceQuery Debug "query" let runQuery :: SqlPersistT IO a -> IO a runQuery cmd = withMVar lock $ const $ observe $ runSqlConn cmd backend - migrations <- runQuery $ runMigrationSilent migrateAll + migrations <- runQuery $ runMigrationQuiet migrateAll dbLog trace $ MsgMigrations (length migrations) pure $ SqliteContext backend runQuery fp trace diff --git a/lib/jormungandr/test/unit/Cardano/Wallet/Jormungandr/TransactionSpec.hs b/lib/jormungandr/test/unit/Cardano/Wallet/Jormungandr/TransactionSpec.hs index a890c7411f0..b026c67fe71 100644 --- a/lib/jormungandr/test/unit/Cardano/Wallet/Jormungandr/TransactionSpec.hs +++ b/lib/jormungandr/test/unit/Cardano/Wallet/Jormungandr/TransactionSpec.hs @@ -92,25 +92,32 @@ mkStdTxSpec :: Spec mkStdTxSpec = do let (xprv0, pwd0) = xprvSeqFromSeed "arbitrary-seed-0" - -- ^ 30c8422fd3cbaf54449df9f627a1f88cf85d4fee84083a91cdb6f0dbdb09c24d - -- ed29409c6a8275a643a2e79d280d97a898a3366706f3f677434b75c9d98680d0 + -- ^ (Private key only, i.e. first 64 bytes) + -- 30c8422fd3cbaf54449df9f627a1f88cf85d4fee84083a91cdb6f0dbdb09c24d + -- ed29409c6a8275a643a2e79d280d97a898a3366706f3f677434b75c9d98680d0 let (xprv1, pwd1) = xprvSeqFromSeed "arbitrary-seed-1" - -- ^ b81e217576bf2683f3359f50d0bf938ca3c61fdf7a2d0c1b2b35f7fb174dc042 - -- 6bb7377c9ea9cb481b4c3df601379fbf69033add18c1d272d7975c43682afc48 + -- ^ (Private key only, i.e. first 64 bytes) + -- b81e217576bf2683f3359f50d0bf938ca3c61fdf7a2d0c1b2b35f7fb174dc042 + -- 6bb7377c9ea9cb481b4c3df601379fbf69033add18c1d272d7975c43682afc48 let (xprv2, pwd2) = xprvSeqFromSeed "arbitrary-seed-2" - -- ^ e01bfb39e3e595fce0b9b19e386a82816e0cef8aa823c75a32bc0f39bcf7c14e - -- 8a03d255df0440b6d0fcf5d5199a582d1df7d858bd7556d4941ebf6223fa66d1 + -- ^ (Private key only, i.e. first 64 bytes) + -- e01bfb39e3e595fce0b9b19e386a82816e0cef8aa823c75a32bc0f39bcf7c14e + -- 8a03d255df0440b6d0fcf5d5199a582d1df7d858bd7556d4941ebf6223fa66d1 let (xprvRnd0, pwdRnd0) = xprvRndFromSeed "arbitrary-seed-0" - -- ^ 183b26b1127ea29c2f053ee8f9d8c0a90c5251235e0fd2bfda401da318045a4d - -- 8fe398f1d0898ee4505e6b2546c1ac5c4b201e0833708312489e26142892a4ae + -- ^ (Extended private key, i.e. private key + chain code = 96 bytes) + -- xprv1rqajdvgj063fctc98m50nkxq4yx9y5frtc8a9076gqw6xxqytfxclcuc78g + -- gnrhy2p0xkf2xcxk9cjeqrcyrxuyrzfyfufs59zf2ftjn0qj2ae2jd02scmxryyf + -- ezx74j836xcqnyegnakyp288gm006fq3xyn72 let (xprvRnd1, pwdRnd1) = xprvRndFromSeed "arbitrary-seed-1" - -- ^ 80330dc0e8382d72313a050add1fdaf8ad3f99f8a0bd56b4a27af497d43d0c53 - -- acdbfa4f24a8e04aa2298ddc623ebbb4b61fd61f6076d269aa6a30ffb6bb7574 + -- ^ (Extended private key, i.e. private key + chain code = 96 bytes) + -- xprv1sqesms8g8qkhyvf6q59d6876lzknlx0c5z74dd9z0t6f04pap3f6ekl6fuj + -- 23cz25g5cmhrz86amfdsl6c0kqakjdx4x5v8lk6ah2axjcglvf0uf0a8aydkxw6v + -- gkc58wfvlsx7e7zx5x4w4le4edndqd5k72xrz let txin0 = Hash $ unsafeFromHex "666984dec4bc0ff1888be97bfe0694a96b35c58d025405ead51d5cc72a3019f4" diff --git a/nix/.stack.nix/default.nix b/nix/.stack.nix/default.nix index bfe4806cde1..11fcdf89357 100644 --- a/nix/.stack.nix/default.nix +++ b/nix/.stack.nix/default.nix @@ -5,8 +5,6 @@ "base58-bytestring" = (((hackage.base58-bytestring)."0.1.0").revisions).default; "quickcheck-state-machine" = (((hackage.quickcheck-state-machine)."0.6.0").revisions).default; "command" = (((hackage.command)."0.1.1").revisions).default; - "persistent-template" = (((hackage.persistent-template)."2.7.2").revisions).default; - "persistent" = (((hackage.persistent)."2.10.1").revisions).default; "time-units" = (((hackage.time-units)."1.0.0").revisions).default; "libsystemd-journal" = (((hackage.libsystemd-journal)."1.4.4").revisions).default; bech32 = ./bech32.nix; @@ -17,7 +15,9 @@ text-class = ./text-class.nix; cardano-wallet-test-utils = ./cardano-wallet-test-utils.nix; cardano-wallet-jormungandr = ./cardano-wallet-jormungandr.nix; + persistent = ./persistent.nix; persistent-sqlite = ./persistent-sqlite.nix; + persistent-template = ./persistent-template.nix; cardano-crypto = ./cardano-crypto.nix; contra-tracer = ./contra-tracer.nix; iohk-monitoring = ./iohk-monitoring.nix; diff --git a/nix/.stack.nix/persistent-sqlite.nix b/nix/.stack.nix/persistent-sqlite.nix index 49a0faf118a..79209c1240f 100644 --- a/nix/.stack.nix/persistent-sqlite.nix +++ b/nix/.stack.nix/persistent-sqlite.nix @@ -130,8 +130,8 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }: } // { src = (pkgs.lib).mkDefault (pkgs.fetchgit { url = "https://github.com/input-output-hk/persistent"; - rev = "79f2ece07eafae005a703c8eda1bd2420b5e07b5"; - sha256 = "081bhdg52wn7vgxsgl4aimy73ccai05j64r24hwkdnjj4kz96lia"; + rev = "107787ecc4c8a112375493cd66574f788f950fce"; + sha256 = "1livmfslqzadir5sc523r111wrd14s5k2nmvsxayk45hx3nnngfb"; }); postUnpack = "sourceRoot+=/persistent-sqlite; echo source root reset to \$sourceRoot"; } \ No newline at end of file diff --git a/nix/.stack.nix/persistent-template.nix b/nix/.stack.nix/persistent-template.nix new file mode 100644 index 00000000000..3d2b25047f5 --- /dev/null +++ b/nix/.stack.nix/persistent-template.nix @@ -0,0 +1,115 @@ +let + buildDepError = pkg: + builtins.throw '' + The Haskell package set does not contain the package: ${pkg} (build dependency). + + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. + ''; + sysDepError = pkg: + builtins.throw '' + The Nixpkgs package set does not contain the package: ${pkg} (system dependency). + + You may need to augment the system package mapping in haskell.nix so that it can be found. + ''; + pkgConfDepError = pkg: + builtins.throw '' + The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency). + + You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found. + ''; + exeDepError = pkg: + builtins.throw '' + The local executable components do not include the component: ${pkg} (executable dependency). + ''; + legacyExeDepError = pkg: + builtins.throw '' + The Haskell package set does not contain the package: ${pkg} (executable dependency). + + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. + ''; + buildToolDepError = pkg: + builtins.throw '' + Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency). + + If this is a system dependency: + You may need to augment the system package mapping in haskell.nix so that it can be found. + + If this is a Haskell dependency: + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. + ''; +in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }: + { + flags = {}; + package = { + specVersion = "1.10"; + identifier = { name = "persistent-template"; version = "2.7.2"; }; + license = "MIT"; + copyright = ""; + maintainer = "Michael Snoyman , Greg Weber "; + author = "Michael Snoyman "; + homepage = "http://www.yesodweb.com/book/persistent"; + url = ""; + synopsis = "Type-safe, non-relational, multi-backend persistence."; + description = "Hackage documentation generation is not reliable. For up to date documentation, please see: ."; + buildType = "Simple"; + isLocal = true; + }; + components = { + "library" = { + depends = [ + (hsPkgs."base" or (buildDepError "base")) + (hsPkgs."persistent" or (buildDepError "persistent")) + (hsPkgs."aeson" or (buildDepError "aeson")) + (hsPkgs."bytestring" or (buildDepError "bytestring")) + (hsPkgs."containers" or (buildDepError "containers")) + (hsPkgs."http-api-data" or (buildDepError "http-api-data")) + (hsPkgs."monad-control" or (buildDepError "monad-control")) + (hsPkgs."monad-logger" or (buildDepError "monad-logger")) + (hsPkgs."path-pieces" or (buildDepError "path-pieces")) + (hsPkgs."template-haskell" or (buildDepError "template-haskell")) + (hsPkgs."text" or (buildDepError "text")) + (hsPkgs."transformers" or (buildDepError "transformers")) + (hsPkgs."unordered-containers" or (buildDepError "unordered-containers")) + ]; + buildable = true; + }; + tests = { + "test" = { + depends = [ + (hsPkgs."base" or (buildDepError "base")) + (hsPkgs."persistent" or (buildDepError "persistent")) + (hsPkgs."persistent-template" or (buildDepError "persistent-template")) + (hsPkgs."aeson" or (buildDepError "aeson")) + (hsPkgs."bytestring" or (buildDepError "bytestring")) + (hsPkgs."hspec" or (buildDepError "hspec")) + (hsPkgs."QuickCheck" or (buildDepError "QuickCheck")) + (hsPkgs."text" or (buildDepError "text")) + ]; + buildable = true; + }; + }; + benchmarks = { + "persistent-th-bench" = { + depends = [ + (hsPkgs."base" or (buildDepError "base")) + (hsPkgs."persistent" or (buildDepError "persistent")) + (hsPkgs."persistent-template" or (buildDepError "persistent-template")) + (hsPkgs."criterion" or (buildDepError "criterion")) + (hsPkgs."deepseq" or (buildDepError "deepseq")) + (hsPkgs."deepseq-generics" or (buildDepError "deepseq-generics")) + (hsPkgs."file-embed" or (buildDepError "file-embed")) + (hsPkgs."text" or (buildDepError "text")) + (hsPkgs."template-haskell" or (buildDepError "template-haskell")) + ]; + buildable = true; + }; + }; + }; + } // { + src = (pkgs.lib).mkDefault (pkgs.fetchgit { + url = "https://github.com/input-output-hk/persistent"; + rev = "107787ecc4c8a112375493cd66574f788f950fce"; + sha256 = "1livmfslqzadir5sc523r111wrd14s5k2nmvsxayk45hx3nnngfb"; + }); + postUnpack = "sourceRoot+=/persistent-template; echo source root reset to \$sourceRoot"; + } \ No newline at end of file diff --git a/nix/.stack.nix/persistent.nix b/nix/.stack.nix/persistent.nix new file mode 100644 index 00000000000..f6cd36e7813 --- /dev/null +++ b/nix/.stack.nix/persistent.nix @@ -0,0 +1,118 @@ +let + buildDepError = pkg: + builtins.throw '' + The Haskell package set does not contain the package: ${pkg} (build dependency). + + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. + ''; + sysDepError = pkg: + builtins.throw '' + The Nixpkgs package set does not contain the package: ${pkg} (system dependency). + + You may need to augment the system package mapping in haskell.nix so that it can be found. + ''; + pkgConfDepError = pkg: + builtins.throw '' + The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency). + + You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found. + ''; + exeDepError = pkg: + builtins.throw '' + The local executable components do not include the component: ${pkg} (executable dependency). + ''; + legacyExeDepError = pkg: + builtins.throw '' + The Haskell package set does not contain the package: ${pkg} (executable dependency). + + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. + ''; + buildToolDepError = pkg: + builtins.throw '' + Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency). + + If this is a system dependency: + You may need to augment the system package mapping in haskell.nix so that it can be found. + + If this is a Haskell dependency: + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. + ''; +in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }: + { + flags = { nooverlap = false; }; + package = { + specVersion = "1.10"; + identifier = { name = "persistent"; version = "2.10.2"; }; + license = "MIT"; + copyright = ""; + maintainer = "Michael Snoyman , Greg Weber "; + author = "Michael Snoyman "; + homepage = "http://www.yesodweb.com/book/persistent"; + url = ""; + synopsis = "Type-safe, multi-backend data serialization."; + description = "Hackage documentation generation is not reliable. For up to date documentation, please see: ."; + buildType = "Simple"; + isLocal = true; + }; + components = { + "library" = { + depends = [ + (hsPkgs."base" or (buildDepError "base")) + (hsPkgs."aeson" or (buildDepError "aeson")) + (hsPkgs."attoparsec" or (buildDepError "attoparsec")) + (hsPkgs."base64-bytestring" or (buildDepError "base64-bytestring")) + (hsPkgs."blaze-html" or (buildDepError "blaze-html")) + (hsPkgs."bytestring" or (buildDepError "bytestring")) + (hsPkgs."conduit" or (buildDepError "conduit")) + (hsPkgs."containers" or (buildDepError "containers")) + (hsPkgs."fast-logger" or (buildDepError "fast-logger")) + (hsPkgs."http-api-data" or (buildDepError "http-api-data")) + (hsPkgs."monad-logger" or (buildDepError "monad-logger")) + (hsPkgs."mtl" or (buildDepError "mtl")) + (hsPkgs."path-pieces" or (buildDepError "path-pieces")) + (hsPkgs."resource-pool" or (buildDepError "resource-pool")) + (hsPkgs."resourcet" or (buildDepError "resourcet")) + (hsPkgs."scientific" or (buildDepError "scientific")) + (hsPkgs."silently" or (buildDepError "silently")) + (hsPkgs."template-haskell" or (buildDepError "template-haskell")) + (hsPkgs."text" or (buildDepError "text")) + (hsPkgs."time" or (buildDepError "time")) + (hsPkgs."transformers" or (buildDepError "transformers")) + (hsPkgs."unliftio-core" or (buildDepError "unliftio-core")) + (hsPkgs."unordered-containers" or (buildDepError "unordered-containers")) + (hsPkgs."vector" or (buildDepError "vector")) + ]; + buildable = true; + }; + tests = { + "test" = { + depends = [ + (hsPkgs."base" or (buildDepError "base")) + (hsPkgs."aeson" or (buildDepError "aeson")) + (hsPkgs."attoparsec" or (buildDepError "attoparsec")) + (hsPkgs."base64-bytestring" or (buildDepError "base64-bytestring")) + (hsPkgs."blaze-html" or (buildDepError "blaze-html")) + (hsPkgs."bytestring" or (buildDepError "bytestring")) + (hsPkgs."containers" or (buildDepError "containers")) + (hsPkgs."hspec" or (buildDepError "hspec")) + (hsPkgs."http-api-data" or (buildDepError "http-api-data")) + (hsPkgs."path-pieces" or (buildDepError "path-pieces")) + (hsPkgs."scientific" or (buildDepError "scientific")) + (hsPkgs."text" or (buildDepError "text")) + (hsPkgs."time" or (buildDepError "time")) + (hsPkgs."transformers" or (buildDepError "transformers")) + (hsPkgs."unordered-containers" or (buildDepError "unordered-containers")) + (hsPkgs."vector" or (buildDepError "vector")) + ]; + buildable = true; + }; + }; + }; + } // { + src = (pkgs.lib).mkDefault (pkgs.fetchgit { + url = "https://github.com/input-output-hk/persistent"; + rev = "107787ecc4c8a112375493cd66574f788f950fce"; + sha256 = "1livmfslqzadir5sc523r111wrd14s5k2nmvsxayk45hx3nnngfb"; + }); + postUnpack = "sourceRoot+=/persistent; echo source root reset to \$sourceRoot"; + } \ No newline at end of file diff --git a/stack.yaml b/stack.yaml index e361653c765..fb134e841bc 100644 --- a/stack.yaml +++ b/stack.yaml @@ -17,15 +17,15 @@ extra-deps: - quickcheck-state-machine-0.6.0 - command-0.1.1 -# persistent-sqlite with CASCADE DELETE support +# persistent-2.10.2 with CASCADE DELETE support for SQLite. # # See: https://github.com/input-output-hk/persistent/tree/cardano-wallet - git: https://github.com/input-output-hk/persistent - commit: 79f2ece07eafae005a703c8eda1bd2420b5e07b5 + commit: 107787ecc4c8a112375493cd66574f788f950fce subdirs: - - persistent-sqlite -- persistent-template-2.7.2 -- persistent-2.10.1 + - persistent + - persistent-sqlite + - persistent-template # cardano-crypto - git: https://github.com/input-output-hk/cardano-crypto