Skip to content

Commit

Permalink
Remove SigningProcessEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
nau committed Mar 2, 2021
1 parent 0db3953 commit 9937efe
Show file tree
Hide file tree
Showing 24 changed files with 20 additions and 296 deletions.
4 changes: 0 additions & 4 deletions nix/pkgs/haskell/materialized-musl/.plan.nix/plutus-pab.nix
Expand Up @@ -139,10 +139,6 @@
"Cardano/Protocol/Socket/Type"
"Cardano/Protocol/Socket/Server"
"Cardano/Protocol/Socket/Client"
"Cardano/SigningProcess/API"
"Cardano/SigningProcess/Server"
"Cardano/SigningProcess/Client"
"Cardano/SigningProcess/Types"
"Cardano/Wallet/API"
"Cardano/Wallet/Client"
"Cardano/Wallet/Mock"
Expand Down
4 changes: 0 additions & 4 deletions nix/pkgs/haskell/materialized-unix/.plan.nix/plutus-pab.nix
Expand Up @@ -139,10 +139,6 @@
"Cardano/Protocol/Socket/Type"
"Cardano/Protocol/Socket/Server"
"Cardano/Protocol/Socket/Client"
"Cardano/SigningProcess/API"
"Cardano/SigningProcess/Server"
"Cardano/SigningProcess/Client"
"Cardano/SigningProcess/Types"
"Cardano/Wallet/API"
"Cardano/Wallet/Client"
"Cardano/Wallet/Mock"
Expand Down
9 changes: 4 additions & 5 deletions plutus-contract/src/Plutus/Trace/Effects/EmulatedWalletAPI.hs
Expand Up @@ -14,19 +14,19 @@ module Plutus.Trace.Effects.EmulatedWalletAPI(
) where

import Control.Monad.Freer (Eff, Member, subsume, type (~>))
import Control.Monad.Freer.Extras (raiseEnd2)
import Control.Monad.Freer.Extras (raiseEnd)
import Control.Monad.Freer.TH (makeEffect)
import Ledger.Tx (txId)
import Ledger.TxId (TxId)
import Ledger.Value (Value)
import Wallet.API (defaultSlotRange, payToPublicKey)
import Wallet.Effects (SigningProcessEffect, WalletEffect)
import Wallet.Effects (WalletEffect)
import qualified Wallet.Emulator as EM
import Wallet.Emulator.MultiAgent (MultiAgentEffect, walletAction)
import Wallet.Emulator.Wallet (Wallet)

data EmulatedWalletAPI r where
LiftWallet :: Wallet -> Eff '[WalletEffect, SigningProcessEffect] a -> EmulatedWalletAPI a
LiftWallet :: Wallet -> Eff '[WalletEffect] a -> EmulatedWalletAPI a

makeEffect ''EmulatedWalletAPI

Expand All @@ -51,5 +51,4 @@ handleEmulatedWalletAPI = \case
LiftWallet w action ->
walletAction w
$ subsume
$ subsume
$ raiseEnd2 action
$ raiseEnd action
7 changes: 3 additions & 4 deletions plutus-contract/src/Plutus/Trace/Emulator/ContractInstance.hs
Expand Up @@ -36,7 +36,7 @@ import Control.Monad.Freer.Coroutine (Yield)
import Control.Monad.Freer.Error (Error, throwError)
import Control.Monad.Freer.Extras.Log (LogMessage, LogMsg (..), LogObserve, logDebug, logError,
logInfo, logWarn, mapLog)
import Control.Monad.Freer.Extras.Modify (raiseEnd11)
import Control.Monad.Freer.Extras.Modify (raiseEnd10)
import Control.Monad.Freer.Reader (Reader, ask, runReader)
import Control.Monad.Freer.State (State, evalState, get, gets, modify, put)
import Data.Aeson (object)
Expand Down Expand Up @@ -64,7 +64,7 @@ import Plutus.Trace.Scheduler (AgentSystemCall,
ThreadId, mkAgentSysCall)
import qualified Wallet.API as WAPI
import Wallet.Effects (ChainIndexEffect, ContractRuntimeEffect (..),
NodeClientEffect, SigningProcessEffect, WalletEffect)
NodeClientEffect, WalletEffect)
import Wallet.Emulator.LogMessages (TxBalanceMsg)
import Wallet.Types (ContractInstanceId, EndpointDescription (..),
EndpointValue (..), Notification (..),
Expand Down Expand Up @@ -286,14 +286,13 @@ respondToRequest :: forall s e effs.
respondToRequest f = do
hks <- getHooks @s @e
let hdl :: (Eff (Reader ContractInstanceId ': ContractRuntimeEffect ': EmulatedWalletEffects) (Maybe (Response (Event s)))) = tryHandler (wrapHandler f) hks
hdl' :: (Eff (ContractInstanceRequests effs) (Maybe (Response (Event s)))) = raiseEnd11 hdl
hdl' :: (Eff (ContractInstanceRequests effs) (Maybe (Response (Event s)))) = raiseEnd10 hdl

response_ :: Eff effs (Maybe (Response (Event s))) =
subsume @(LogMsg T.Text)
$ subsume @(LogMsg TxBalanceMsg)
$ subsume @(LogMsg RequestHandlerLogMsg)
$ subsume @(LogObserve (LogMessage T.Text))
$ subsume @SigningProcessEffect
$ subsume @ChainIndexEffect
$ subsume @NodeClientEffect
$ subsume @(Error WAPI.WalletAPIError)
Expand Down
1 change: 0 additions & 1 deletion plutus-contract/src/Plutus/Trace/Emulator/Types.hs
Expand Up @@ -120,7 +120,6 @@ type EmulatedWalletEffects' effs =
': Error WAPI.WalletAPIError
': Wallet.NodeClientEffect
': Wallet.ChainIndexEffect
': Wallet.SigningProcessEffect
': LogObserve (LogMessage T.Text)
': LogMsg RequestHandlerLogMsg
': LogMsg TxBalanceMsg
Expand Down
4 changes: 0 additions & 4 deletions plutus-contract/src/Wallet/API.hs
Expand Up @@ -26,8 +26,6 @@ module Wallet.API(
NodeClientEffect,
publishTx,
getClientSlot,
SigningProcessEffect,
addSignatures,
ChainIndexEffect,
startWatching,
watchedAddresses,
Expand Down Expand Up @@ -78,7 +76,6 @@ createPaymentWithChange v =
-- transaction that was submitted.
payToPublicKey ::
( Member WalletEffect effs
, Member SigningProcessEffect effs
)
=> SlotRange -> Value -> PubKey -> Eff effs Tx
payToPublicKey range v pk = do
Expand All @@ -89,7 +86,6 @@ payToPublicKey range v pk = do
-- | Transfer some funds to an address locked by a public key.
payToPublicKey_ ::
( Member WalletEffect effs
, Member SigningProcessEffect effs
)
=> SlotRange -> Value -> PubKey -> Eff effs ()
payToPublicKey_ r v = void . payToPublicKey r v
Expand Down
8 changes: 0 additions & 8 deletions plutus-contract/src/Wallet/Effects.hs
Expand Up @@ -25,9 +25,6 @@ module Wallet.Effects(
, NodeClientEffect(..)
, publishTx
, getClientSlot
-- * Signing process
, SigningProcessEffect(..)
, addSignatures
-- * Chain index
, ChainIndexEffect(..)
, AddressChangeRequest(..)
Expand Down Expand Up @@ -62,10 +59,6 @@ data NodeClientEffect r where
GetClientSlot :: NodeClientEffect Slot
makeEffect ''NodeClientEffect

data SigningProcessEffect r where
AddSignatures :: [PubKeyHash] -> Tx -> SigningProcessEffect Tx
makeEffect ''SigningProcessEffect

{-| Access the chain index. The chain index keeps track of the
datums that are associated with unspent transaction outputs. Addresses that
are of interest need to be added with 'startWatching' before their outputs
Expand All @@ -91,7 +84,6 @@ makeEffect ''ContractRuntimeEffect
type WalletEffects =
'[ WalletEffect
, NodeClientEffect
, SigningProcessEffect
, ChainIndexEffect
, ContractRuntimeEffect
]
6 changes: 2 additions & 4 deletions plutus-contract/src/Wallet/Emulator/MultiAgent.hs
Expand Up @@ -22,7 +22,7 @@ import Control.Monad
import Control.Monad.Freer
import Control.Monad.Freer.Error
import Control.Monad.Freer.Extras.Log (LogMessage, LogMsg, LogObserve, handleObserveLog, mapLog)
import Control.Monad.Freer.Extras.Modify (handleZoomedState, raiseEnd5, raiseEnd9, writeIntoState)
import Control.Monad.Freer.Extras.Modify (handleZoomedState, raiseEnd5, raiseEnd8, writeIntoState)
import Control.Monad.Freer.State
import Data.Aeson (FromJSON, ToJSON)
import Data.Map (Map)
Expand Down Expand Up @@ -193,7 +193,6 @@ handleMultiAgentEffects wallet =
. interpret (raiseWallet @(LogMsg TxBalanceMsg) wallet)
. interpret (raiseWallet @(LogMsg RequestHandlerLogMsg) wallet)
. interpret (raiseWallet @(LogObserve (LogMessage T.Text)) wallet)
. interpret (raiseWallet @WAPI.SigningProcessEffect wallet)
. interpret (raiseWallet @WAPI.ChainIndexEffect wallet)
. interpret (raiseWallet @WAPI.NodeClientEffect wallet)
. interpret (raiseWallet @(Error WAPI.WalletAPIError) wallet)
Expand Down Expand Up @@ -355,12 +354,11 @@ handleMultiAgent = interpret $ \case
p7 :: AReview EmulatorEvent' Notify.EmulatorNotifyLogMsg
p7 = notificationEvent
act
& raiseEnd9
& raiseEnd8
& Wallet.handleWallet
& subsume
& NC.handleNodeClient
& ChainIndex.handleChainIndex
& Wallet.handleSigningProcess
& handleObserveLog
& interpret (mapLog (review p5))
& interpret (mapLog (review p6))
Expand Down
9 changes: 1 addition & 8 deletions plutus-contract/src/Wallet/Emulator/Wallet.hs
Expand Up @@ -42,8 +42,7 @@ import qualified Ledger.Value as Value
import Prelude as P
import Servant.API (FromHttpApiData (..), ToHttpApiData (..))
import qualified Wallet.API as WAPI
import Wallet.Effects (ChainIndexEffect, NodeClientEffect, SigningProcessEffect (..),
WalletEffect (..))
import Wallet.Effects (ChainIndexEffect, NodeClientEffect, WalletEffect (..))
import qualified Wallet.Effects as W
import Wallet.Emulator.ChainIndex (ChainIndexState)
import Wallet.Emulator.LogMessages (RequestHandlerLogMsg, TxBalanceMsg)
Expand Down Expand Up @@ -276,9 +275,3 @@ type SigningProcessEffs = '[State SigningProcess, Error WAPI.WalletAPIError]
handleSigningProcessControl :: (Members SigningProcessEffs effs) => Eff (SigningProcessControlEffect ': effs) ~> Eff effs
handleSigningProcessControl = interpret $ \case
SetSigningProcess proc -> put proc

handleSigningProcess :: (Members SigningProcessEffs effs) => Eff (SigningProcessEffect ': effs) ~> Eff effs
handleSigningProcess = interpret $ \case
AddSignatures sigs tx -> do
SigningProcess process <- get
process sigs tx
17 changes: 2 additions & 15 deletions plutus-pab/app/Cli.hs
Expand Up @@ -61,7 +61,6 @@ import Cardano.BM.Data.Trace (Trace)
import qualified Cardano.ChainIndex.Server as ChainIndex
import qualified Cardano.Metadata.Server as Metadata
import qualified Cardano.Node.Server as NodeServer
import qualified Cardano.SigningProcess.Server as SigningProcess
import qualified Cardano.Wallet.Server as WalletServer
import Cardano.Wallet.Types
import Control.Concurrent (threadDelay)
Expand Down Expand Up @@ -93,12 +92,11 @@ import qualified Plutus.PAB.Core.ContractInstance as Instance
import Plutus.PAB.Events.Contract (ContractInstanceId (..))
import Plutus.PAB.PABLogMsg (AppMsg (..), ChainIndexServerMsg,
ContractExeLogMsg (..), MetadataLogMessage,
MockServerLogMsg, PABLogMsg (..), SigningProcessMsg)
MockServerLogMsg, PABLogMsg (..))
import Plutus.PAB.Types (Config (Config), ContractExe (..), PABError,
RequestProcessingConfig (..), chainIndexConfig,
metadataServerConfig, nodeServerConfig,
requestProcessingConfig, signingProcessConfig,
walletServerConfig)
requestProcessingConfig, walletServerConfig)
import qualified Plutus.PAB.Webserver.Server as PABServer

-- | Interpret a 'Command' in 'Eff' using the provided tracer and configurations
Expand Down Expand Up @@ -170,14 +168,6 @@ runCliCommand t _ Config {nodeServerConfig, chainIndexConfig} serviceAvailabilit
(mscBaseUrl nodeServerConfig)
serviceAvailability


-- Run the signing-process service
runCliCommand t _ Config {signingProcessConfig} serviceAvailability SigningProcess =
liftIO $ SigningProcess.main
(toSigningProcessLog t)
signingProcessConfig
serviceAvailability

-- Install a contract
runCliCommand _ _ _ _ (InstallContract path) =
interpret (mapLog SCoreMsg)
Expand Down Expand Up @@ -259,9 +249,6 @@ toPABMsg = convertLog PABMsg
toChainIndexLog :: Trace m AppMsg -> Trace m ChainIndexServerMsg
toChainIndexLog = convertLog $ PABMsg . SChainIndexServerMsg

toSigningProcessLog :: Trace m AppMsg -> Trace m SigningProcessMsg
toSigningProcessLog = convertLog $ PABMsg . SSigningProcessMsg

toWalletLog :: Trace m AppMsg -> Trace m WalletMsg
toWalletLog = convertLog $ PABMsg . SWalletMsg

Expand Down
1 change: 0 additions & 1 deletion plutus-pab/app/Command.hs
Expand Up @@ -23,7 +23,6 @@ data Command
| ChainIndex -- ^ Run the chain index service
| Metadata -- ^ Run the mock meta-data service
| ForkCommands [Command] -- ^ Fork a list of commands
| SigningProcess -- ^ Run the signing process service
| InstallContract FilePath -- ^ Install a contract
| ActivateContract FilePath -- ^ Activate a contract
| ContractState UUID -- ^ Display the contract identified by 'UUID'
Expand Down
8 changes: 0 additions & 8 deletions plutus-pab/app/CommandParser.hs
Expand Up @@ -93,7 +93,6 @@ commandParser =
, mockNodeParser
, chainIndexParser
, metadataParser
, signingProcessParser
, reportTxHistoryParser
, defaultConfigParser
, command
Expand Down Expand Up @@ -180,7 +179,6 @@ allServersParser =
, Metadata
, MockWallet
, PABWebserver
, SigningProcess
, ProcessAllContractOutboxes
]))
(fullDesc <> progDesc "Run all the mock servers needed.")
Expand All @@ -195,16 +193,10 @@ clientServicesParser =
, Metadata
, MockWallet
, PABWebserver
, SigningProcess
, ProcessAllContractOutboxes
]))
(fullDesc <> progDesc "Run the client services (all services except the mock node).")

signingProcessParser :: Mod CommandFields Command
signingProcessParser =
command "signing-process" $
info (pure SigningProcess) (fullDesc <> progDesc "Run the signing process.")

activateContractParser :: Mod CommandFields Command
activateContractParser =
command "activate" $
Expand Down
4 changes: 0 additions & 4 deletions plutus-pab/plutus-pab.cabal
Expand Up @@ -68,10 +68,6 @@ library
Cardano.Protocol.Socket.Type
Cardano.Protocol.Socket.Server
Cardano.Protocol.Socket.Client
Cardano.SigningProcess.API
Cardano.SigningProcess.Server
Cardano.SigningProcess.Client
Cardano.SigningProcess.Types
Cardano.Wallet.API
Cardano.Wallet.Client
Cardano.Wallet.Mock
Expand Down
5 changes: 0 additions & 5 deletions plutus-pab/plutus-pab.yaml
Expand Up @@ -30,10 +30,5 @@ chainIndexConfig:
requestProcessingConfig:
requestProcessingInterval: 1

signingProcessConfig:
spBaseUrl: http://localhost:8084
spWallet:
getWallet: 1

metadataServerConfig:
mdBaseUrl: http://localhost:8085
11 changes: 0 additions & 11 deletions plutus-pab/src/Cardano/SigningProcess/API.hs

This file was deleted.

39 changes: 0 additions & 39 deletions plutus-pab/src/Cardano/SigningProcess/Client.hs

This file was deleted.

0 comments on commit 9937efe

Please sign in to comment.