Skip to content
Permalink
Browse files

final fix

fix jormungandr unit tests

hlint
  • Loading branch information...
paweljakubas committed Jul 12, 2019
1 parent 4a2aae1 commit d3e0fbc19325a206dd64d01f9e5c89e44d35761a
@@ -546,7 +546,7 @@ newWalletLayer
-> BlockHeader
-> IO ()
restoreSleep t wid slot =
let halfSlotLengthDelay = fromIntegral $ (diffTimeToPicoseconds slotLength `div` 500000) in do
let halfSlotLengthDelay = fromIntegral (diffTimeToPicoseconds slotLength `div` 2000000) in do
threadDelay halfSlotLengthDelay
runExceptT (networkTip nw) >>= \case
Left e -> do
@@ -96,6 +96,7 @@ test-suite unit
, QuickCheck
, text
, text-class
, time
, transformers
build-tools:
hspec-discover
@@ -36,14 +36,12 @@ import Cardano.Wallet.Jormungandr.Compatibility
( Jormungandr, Network (..) )
import Cardano.Wallet.Jormungandr.Network
( BaseUrl (..), JormungandrLayer (..), Scheme (..), mkJormungandrLayer )
import Cardano.Wallet.Jormungandr.Primitive.Types
( Tx (..) )
import Cardano.Wallet.Network
( NetworkLayer (..), defaultRetryPolicy, waitForConnection )
import Cardano.Wallet.Primitive.Fee
( FeePolicy (..) )
import Cardano.Wallet.Primitive.Types
( Block (..), Hash (..), SlotLength )
( Hash (..) )
import Cardano.Wallet.Unsafe
( unsafeFromHex, unsafeRunExceptT )
import Control.Concurrent
@@ -182,7 +180,8 @@ cardanoWalletServer
cardanoWalletServer mlisten = do
logConfig <- CM.empty
tracer <- initTracer Info "serve"
(nl, bp) <- newNetworkLayer jormungandrUrl block0H
(nl, bp@(BlockchainParameters _ feePolicy _) ) <-
newNetworkLayer jormungandrUrl block0H
(sqlCtx, db) <- Sqlite.newDBLayer @_ @network logConfig tracer Nothing
mvar <- newEmptyMVar
handle <- async $ do
@@ -206,17 +205,15 @@ cardanoWalletServer mlisten = do
newNetworkLayer
:: BaseUrl
-> Hash "Genesis"
-> IO (NetworkLayer (Jormungandr n) IO, Block Tx, FeePolicy, SlotLength)
-> IO (NetworkLayer (Jormungandr n) IO, BlockchainParameters (Jormungandr n))
newNetworkLayer url block0H = do
mgr <- newManager defaultManagerSettings
let jormungandr = mkJormungandrLayer mgr url
let nl = Jormungandr.mkNetworkLayer jormungandr
waitForConnection nl defaultRetryPolicy
block0 <- unsafeRunExceptT $
getBlock jormungandr (coerce block0H)
(feePolicy, slotLength) <- unsafeRunExceptT $
blockchainParams <- unsafeRunExceptT $
getInitialBlockchainParameters jormungandr (coerce block0H)
return (nl, block0, feePolicy, slotLength)
return (nl, blockchainParams)

mkFeeEstimator :: FeePolicy -> TxDescription -> (Natural, Natural)
mkFeeEstimator policy (TxDescription nInps nOuts) =
@@ -64,6 +64,8 @@ import Data.Proxy
( Proxy (..) )
import Data.Quantity
( Quantity (..) )
import Data.Time.Clock
( secondsToDiffTime )
import Data.Word
( Word8 )
import GHC.Generics
@@ -120,7 +122,7 @@ spec = do
, Discrimination Testnet
, Consensus BFT
, SlotsPerEpoch (Quantity 2160)
, SlotDuration (Quantity 15)
, SlotDuration (secondsToDiffTime 15)
, EpochStabilityDepth (Quantity 10)
, AddBftLeader $ LeaderId $ unsafeFromHex
"30a694b80dbba2d1b8a4b55652b03d96\
@@ -173,7 +175,7 @@ spec = do
, Discrimination Mainnet
, Consensus BFT
, SlotsPerEpoch (Quantity 500)
, SlotDuration (Quantity 10)
, SlotDuration (secondsToDiffTime 10)
, EpochStabilityDepth (Quantity 10)
, AddBftLeader $ LeaderId $ unsafeFromHex
"b216ee388fc25596cf43fbca815c463c\

Some generated files are not rendered by default. Learn more.

0 comments on commit d3e0fbc

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