Skip to content
Permalink
Browse files

Another round of fixups

  • Loading branch information
Anviking committed Feb 14, 2020
1 parent 58820d4 commit 882b995e7d593789b35a0f7b5002b206fb88565c
@@ -103,6 +103,8 @@ import Cardano.Wallet.Primitive.Types
, unsafeEpochNo
, wholeRange
)
import Cardano.Wallet.Unsafe
( unsafeMkSomeMnemonicFromEntropy )
import Control.Arrow
( second )
import Control.DeepSeq
@@ -121,6 +123,8 @@ import Data.Generics.Labels
()
import Data.List
( unfoldr )
import Data.Proxy
( Proxy (..) )
import Data.Quantity
( Quantity (..) )
import Data.Text.Class
@@ -467,7 +471,7 @@ rootKeysSeq = unsafePerformIO $ generate (vectorOf 10 genRootKeysSeq)
where
genRootKeysSeq :: Gen (ShelleyKey 'RootK XPrv)
genRootKeysSeq = do
s <- (SomeMnemonic <$> genMnemonic @12)
s <- SomeMnemonic <$> genMnemonic @12
g <- frequency
[ (1, return Nothing)
, (3, Just . SomeMnemonic <$> genMnemonic @12)
@@ -481,14 +485,14 @@ arbitrarySeqAccount
arbitrarySeqAccount =
publicKey $ unsafeGenerateKeyFromSeed (mw, Nothing) mempty
where
mw = SomeMnemonic $ unsafePerformIO $ generate $ genMnemonic @15
mw = unsafeMkSomeMnemonicFromEntropy (Proxy @15) (BS.replicate 32 0)

arbitraryRewardAccount
:: ShelleyKey 'AddressK XPub
arbitraryRewardAccount =
publicKey $ unsafeGenerateKeyFromSeed (mw, Nothing) mempty
where
mw = SomeMnemonic $ unsafePerformIO $ generate $ genMnemonic @15
mw = unsafeMkSomeMnemonicFromEntropy (Proxy @15) (BS.replicate 32 0)

{-------------------------------------------------------------------------------
Random State
@@ -24,17 +24,17 @@ import Cardano.Wallet.Primitive.AddressDerivation
, Passphrase (..)
, SomeMnemonic (..)
, XPrv
, fromMnemonic
)
import Cardano.Wallet.Primitive.AddressDerivation.Byron
( ByronKey (..)
, generateKeyFromSeed
, minSeedLengthBytes
, unsafeGenerateKeyFromSeed
)

import Cardano.Wallet.Primitive.AddressDerivationSpec
()
import Cardano.Wallet.Unsafe
( unsafeMkMnemonic )
import Control.Monad
( (<=<) )
import Data.ByteArray.Encoding
@@ -102,7 +102,7 @@ generateTest GenerateKeyFromSeed{..} =
`shouldBe`
getKey rootKey
where
mw = either (error . show) id $ fromMnemonic @'[12] mnem
mw = SomeMnemonic $ unsafeMkMnemonic @12 mnem

generateTest1 :: GenerateKeyFromSeed
generateTest1 = GenerateKeyFromSeed
@@ -417,5 +417,5 @@ genLegacyAddress range = do
let crc = BS.pack [26,1,2,3,4]
return $ Address (prefix <> addrPayload <> crc)

instance {-# OVERLAPS #-} Arbitrary SomeMnemonic where
instance Arbitrary SomeMnemonic where
arbitrary = SomeMnemonic <$> genMnemonic @12
@@ -62,12 +62,10 @@ import Cardano.Wallet.Primitive.AddressDiscovery.Sequential
, mkSeqState
, shrinkPool
)
import Cardano.Wallet.Primitive.Mnemonic
( entropyToMnemonic )
import Cardano.Wallet.Primitive.Types
( Address (..), ShowFmt (..) )
import Cardano.Wallet.Unsafe
( unsafeMkEntropy, unsafeMkSomeMnemonicFromEntropy )
( unsafeMkSomeMnemonicFromEntropy )
import Control.Monad
( forM, forM_, unless )
import Control.Monad.IO.Class
@@ -346,9 +344,7 @@ prop_genChangeGap
prop_genChangeGap g =
property prop
where
mw = SomeMnemonic
$ entropyToMnemonic @12
$ unsafeMkEntropy "0000000000000000"
mw = unsafeMkSomeMnemonicFromEntropy (Proxy @12) "0000000000000000"
key = Shelley.unsafeGenerateKeyFromSeed (mw, Nothing) mempty
s0 = mkSeqState (key, mempty) g
prop =

0 comments on commit 882b995

Please sign in to comment.
You can’t perform that action at this time.