Skip to content

Commit

Permalink
Merge #918
Browse files Browse the repository at this point in the history
918: Fix Sqlite DB on Windows r=rvl a=rvl

Relates to #703.
Based on the branch of #888.

# Overview

The wallet failed with:

    NUL: openFile: does not exist (No such file or directory)

This is due to runMigrationSilent which uses the silently library:

http://hackage.haskell.org/package/silently-1.2.5.1/docs/src/System.IO.Silently.html#line-27

To fix, we swap `runMigrationQuiet` for `runMigrationSilent` on Windows.


Co-authored-by: KtorZ <matthias.benkort@gmail.com>
Co-authored-by: iohk-bors[bot] <43231472+iohk-bors[bot]@users.noreply.github.com>
Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
  • Loading branch information
3 people authored Nov 5, 2019
2 parents d27da42 + 23875ba commit ba35bdc
Show file tree
Hide file tree
Showing 7 changed files with 261 additions and 21 deletions.
4 changes: 2 additions & 2 deletions lib/core/src/Cardano/DB/Sqlite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions nix/.stack.nix/default.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/.stack.nix/persistent-sqlite.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 115 additions & 0 deletions nix/.stack.nix/persistent-template.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

118 changes: 118 additions & 0 deletions nix/.stack.nix/persistent.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba35bdc

Please sign in to comment.