From c947ed4bf1dca9bcca0f0fa299155150ac7b6e4e Mon Sep 17 00:00:00 2001 From: KtorZ Date: Fri, 10 Jul 2020 17:01:45 +0200 Subject: [PATCH] Add stake address constraints to Jormungandr and Byron --- lib/byron/src/Cardano/Wallet/Byron.hs | 4 +++- lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs | 4 ++-- lib/byron/src/Cardano/Wallet/Byron/Launch.hs | 3 +++ lib/core/test/bench/db/Main.hs | 2 +- lib/jormungandr/src/Cardano/Wallet/Jormungandr.hs | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/byron/src/Cardano/Wallet/Byron.hs b/lib/byron/src/Cardano/Wallet/Byron.hs index ac751e6fe76..0fa525420c9 100644 --- a/lib/byron/src/Cardano/Wallet/Byron.hs +++ b/lib/byron/src/Cardano/Wallet/Byron.hs @@ -60,7 +60,7 @@ import Cardano.Wallet.Api import Cardano.Wallet.Api.Server ( HostPreference, Listen (..), ListenError (..), TlsConfiguration ) import Cardano.Wallet.Api.Types - ( ApiStakePool, DecodeAddress, EncodeAddress ) + ( ApiStakePool, DecodeAddress, EncodeAddress, EncodeStakeAddress ) import Cardano.Wallet.Byron.Api.Server ( server ) import Cardano.Wallet.Byron.Compatibility @@ -157,6 +157,7 @@ data SomeNetworkDiscriminant where , PaymentAddress n ByronKey , DecodeAddress n , EncodeAddress n + , EncodeStakeAddress n , MaxSizeOf Address n IcarusKey , MaxSizeOf Address n ByronKey ) @@ -242,6 +243,7 @@ serveWallet , PaymentAddress n ByronKey , DecodeAddress n , EncodeAddress n + , EncodeStakeAddress n ) => Proxy n -> Socket diff --git a/lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs b/lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs index bbebfe89139..5eddda84c65 100644 --- a/lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs +++ b/lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs @@ -502,11 +502,11 @@ fromProtocolMagicId = W.ProtocolMagic . fromIntegral . unProtocolMagicId Address Encoding / Decoding -------------------------------------------------------------------------------} -instance EncodeStakeAddress n where +instance {-# OVERLAPS #-} EncodeStakeAddress n where encodeStakeAddress = error "encodeStakeAddress: there's no such thing as stake address in Byron" -instance DecodeStakeAddress n where +instance {-# OVERLAPS #-} DecodeStakeAddress n where decodeStakeAddress = error "decodeStakeAddress: there's no such thing as stake address in Byron" diff --git a/lib/byron/src/Cardano/Wallet/Byron/Launch.hs b/lib/byron/src/Cardano/Wallet/Byron/Launch.hs index 324dc5d0cd3..5b819f9a990 100644 --- a/lib/byron/src/Cardano/Wallet/Byron/Launch.hs +++ b/lib/byron/src/Cardano/Wallet/Byron/Launch.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} @@ -37,6 +38,8 @@ import Cardano.Crypto.ProtocolMagic ( ProtocolMagicId (..) ) import Cardano.Launcher ( Command (..), StdStream (..), withBackendProcess ) +import Cardano.Wallet.Api.Types + ( EncodeStakeAddress (..) ) import Cardano.Wallet.Byron ( SomeNetworkDiscriminant (..) ) import Cardano.Wallet.Byron.Compatibility diff --git a/lib/core/test/bench/db/Main.hs b/lib/core/test/bench/db/Main.hs index 324a50a2040..0c81eeb3aee 100644 --- a/lib/core/test/bench/db/Main.hs +++ b/lib/core/test/bench/db/Main.hs @@ -406,7 +406,7 @@ benchReadTxHistory sortOrder (inf, sup) mstatus DBLayer{..} = mkTxHistory :: Int -> Int -> Int -> [Word64] -> [(Tx, TxMeta)] mkTxHistory numTx numInputs numOutputs range = [ force - ( (Tx (mkTxId inps outs) inps outs) + ( (Tx (mkTxId inps outs mempty) inps outs mempty) , TxMeta { status = [InLedger, Pending] !! (i `mod` 2) , direction = Incoming diff --git a/lib/jormungandr/src/Cardano/Wallet/Jormungandr.hs b/lib/jormungandr/src/Cardano/Wallet/Jormungandr.hs index 0537f7cdf52..4b13d2a7356 100644 --- a/lib/jormungandr/src/Cardano/Wallet/Jormungandr.hs +++ b/lib/jormungandr/src/Cardano/Wallet/Jormungandr.hs @@ -76,7 +76,7 @@ import Cardano.Wallet.Api import Cardano.Wallet.Api.Server ( HostPreference, Listen (..), ListenError (..) ) import Cardano.Wallet.Api.Types - ( DecodeAddress, EncodeAddress ) + ( DecodeAddress, EncodeAddress, EncodeStakeAddress ) import Cardano.Wallet.DB.Sqlite ( DefaultFieldValues (..), PersistState ) import Cardano.Wallet.Jormungandr.Api.Server @@ -196,6 +196,7 @@ serveWallet ( t ~ Jormungandr , NetworkDiscriminantVal n , DecodeAddress n + , EncodeStakeAddress n , EncodeAddress n , DelegationAddress n JormungandrKey )