From e677e88d91046ca40bbf22a39977aad69eacc28f Mon Sep 17 00:00:00 2001 From: Edsko de Vries Date: Tue, 14 Aug 2018 13:38:01 +0200 Subject: [PATCH] [CBR-227] Go over TODOs, remove stray, add tickets --- server/Main.hs | 4 ---- src/Cardano/Wallet/API/V1/Handlers/Transactions.hs | 2 -- src/Cardano/Wallet/Kernel.hs | 4 ++-- src/Cardano/Wallet/Kernel/Addresses.hs | 2 -- .../Wallet/Kernel/CoinSelection/FromGeneric.hs | 2 +- src/Cardano/Wallet/Kernel/DB/HdWallet.hs | 2 -- src/Cardano/Wallet/Kernel/DB/HdWallet/Create.hs | 3 --- src/Cardano/Wallet/Kernel/DB/HdWallet/Read.hs | 5 ----- src/Cardano/Wallet/Kernel/DB/Resolved.hs | 4 ---- src/Cardano/Wallet/Kernel/DB/Sqlite.hs | 2 +- src/Cardano/Wallet/Kernel/DB/TxMeta/Types.hs | 2 -- src/Cardano/Wallet/Kernel/Mode.hs | 14 ++++---------- src/Cardano/Wallet/Server.hs | 5 +---- 13 files changed, 9 insertions(+), 42 deletions(-) diff --git a/server/Main.hs b/server/Main.hs index 47988d8c754..e30503d7d09 100644 --- a/server/Main.hs +++ b/server/Main.hs @@ -127,10 +127,6 @@ actionWithNewWallet pm txpConfig sscParams nodeParams params = sscParams (txpGlobalSettings pm txpConfig) (initNodeDBs pm epochSlots) $ \nr -> do - -- TODO: Will probably want to extract some parameters from the - -- 'NewWalletBackendParams' to construct or initialize the wallet - - -- TODO(ks): Currently using non-implemented layer for wallet layer. userSecret <- readTVarIO (ncUserSecret $ nrContext nr) let nodeState = NodeStateAdaptor.newNodeStateAdaptor nr liftIO $ Keystore.bracketLegacyKeystore userSecret $ \keystore -> do diff --git a/src/Cardano/Wallet/API/V1/Handlers/Transactions.hs b/src/Cardano/Wallet/API/V1/Handlers/Transactions.hs index 4ebb4b51e9a..c45db42b611 100644 --- a/src/Cardano/Wallet/API/V1/Handlers/Transactions.hs +++ b/src/Cardano/Wallet/API/V1/Handlers/Transactions.hs @@ -53,8 +53,6 @@ newTransaction :: ActiveWalletLayer IO -> Handler (WalletResponse Transaction) newTransaction aw payment@Payment{..} = do - -- TODO(adn) If the wallet is being restored, we need to disallow any @Payment@ from - -- being submitted. -- NOTE(adn) The 'SenderPaysFee' option will become configurable as part -- of CBR-291. res <- liftIO $ (WalletLayer.pay aw) (maybe mempty coerce pmtSpendingPassword) diff --git a/src/Cardano/Wallet/Kernel.hs b/src/Cardano/Wallet/Kernel.hs index 8b8c0542a00..114cc965418 100644 --- a/src/Cardano/Wallet/Kernel.hs +++ b/src/Cardano/Wallet/Kernel.hs @@ -103,7 +103,7 @@ data WalletHandles = Handles { handlesOpen :: IO WalletHandles handlesOpen = do db <- openMemoryState defDB - metadb <- openMetaDB ":memory:" -- TODO: Eventually :memory: should be replaced with the real path. + metadb <- openMetaDB ":memory:" -- TODO: CBR-378 migrateMetaDB metadb -- TODO: this will be run with asynchronous exceptions masked. return $ Handles db metadb @@ -144,7 +144,7 @@ init PassiveWallet{..} = do -- | Prefilter the block for each esk in the `WalletESK` map. -- Return a unified Map of accountId and prefiltered blocks (representing multiple ESKs) --- TODO(@uroboros/ryan) optimisation: we are prefiltering the block n times for n keys, change this to be a single pass +-- TODO: Improve performance (CBR-379) prefilterBlock' :: PassiveWallet -> ResolvedBlock -> IO (Map HdAccountId PrefilteredBlock) diff --git a/src/Cardano/Wallet/Kernel/Addresses.hs b/src/Cardano/Wallet/Kernel/Addresses.hs index 567e8823161..b088dcc5e4c 100644 --- a/src/Cardano/Wallet/Kernel/Addresses.hs +++ b/src/Cardano/Wallet/Kernel/Addresses.hs @@ -52,8 +52,6 @@ data CreateAddressError = -- to find another random index would be too expensive deriving Eq --- TODO(adn): This will be done as part of my work on the 'newTransaction' --- endpoint, see [CBR-313]. instance Arbitrary CreateAddressError where arbitrary = oneof [] diff --git a/src/Cardano/Wallet/Kernel/CoinSelection/FromGeneric.hs b/src/Cardano/Wallet/Kernel/CoinSelection/FromGeneric.hs index e245f950620..f2910c52f84 100644 --- a/src/Cardano/Wallet/Kernel/CoinSelection/FromGeneric.hs +++ b/src/Cardano/Wallet/Kernel/CoinSelection/FromGeneric.hs @@ -250,7 +250,7 @@ runCoinSelT opts pickUtxo policy request utxo = do originalOuts = case outs of [] -> error "runCoinSelT: empty list of outputs" o:os -> o :| os - -- TODO: We should shuffle allOuts + -- TODO: We should shuffle allOuts CBR-380 return . Right $ CoinSelFinalResult allInps originalOuts (concatMap coinSelChange css) diff --git a/src/Cardano/Wallet/Kernel/DB/HdWallet.hs b/src/Cardano/Wallet/Kernel/DB/HdWallet.hs index bc96581a4d7..beb5393c927 100644 --- a/src/Cardano/Wallet/Kernel/DB/HdWallet.hs +++ b/src/Cardano/Wallet/Kernel/DB/HdWallet.hs @@ -239,8 +239,6 @@ instance Arbitrary HdAddressId where -- address indices. -- -- NOTE: We do not store the encrypted key of the wallet. --- --- TODO: synchronization state data HdRoot = HdRoot { -- | Wallet ID _hdRootId :: HdRootId diff --git a/src/Cardano/Wallet/Kernel/DB/HdWallet/Create.hs b/src/Cardano/Wallet/Kernel/DB/HdWallet/Create.hs index a92cc407d2a..8d41ce5e953 100644 --- a/src/Cardano/Wallet/Kernel/DB/HdWallet/Create.hs +++ b/src/Cardano/Wallet/Kernel/DB/HdWallet/Create.hs @@ -148,9 +148,6 @@ initHdRoot rootId name hasPass assurance created = HdRoot { -- -- It is the responsibility of the caller to check the wallet's spending -- password. --- --- TODO: If any key derivation is happening when creating accounts, should we --- store a public key or an address or something? initHdAccount :: HdAccountId -> Checkpoint -> HdAccount diff --git a/src/Cardano/Wallet/Kernel/DB/HdWallet/Read.hs b/src/Cardano/Wallet/Kernel/DB/HdWallet/Read.hs index aedd6346670..dad994194a1 100644 --- a/src/Cardano/Wallet/Kernel/DB/HdWallet/Read.hs +++ b/src/Cardano/Wallet/Kernel/DB/HdWallet/Read.hs @@ -2,11 +2,6 @@ -- -- NOTE: These are pure functions, which are intended to work on a snapshot -- of the database. They are intended to support the V1 wallet API. --- --- TODO: We need to think about which layer will have the responsibility for --- filtering and sorting. If we want the 'IxSet' stuff to be local to the --- "Kernel.DB" namespace (which would be a good thing), then filtering and --- sorting (and maybe even pagination) will need to happen here. module Cardano.Wallet.Kernel.DB.HdWallet.Read ( -- | * Infrastructure HdQuery diff --git a/src/Cardano/Wallet/Kernel/DB/Resolved.hs b/src/Cardano/Wallet/Kernel/DB/Resolved.hs index 34a7cf75811..34f5392c45c 100644 --- a/src/Cardano/Wallet/Kernel/DB/Resolved.hs +++ b/src/Cardano/Wallet/Kernel/DB/Resolved.hs @@ -71,10 +71,6 @@ data ResolvedBlock = ResolvedBlock { makeLenses ''ResolvedTx makeLenses ''ResolvedBlock --- TODO: Why are these necessary? and if they're not, get rid of InDb ---deriveSafeCopy 1 'base ''ResolvedTx ---deriveSafeCopy 1 'base ''ResolvedBlock - {------------------------------------------------------------------------------- Pretty-printing -------------------------------------------------------------------------------} diff --git a/src/Cardano/Wallet/Kernel/DB/Sqlite.hs b/src/Cardano/Wallet/Kernel/DB/Sqlite.hs index 029e3546e9d..fb849e07e98 100644 --- a/src/Cardano/Wallet/Kernel/DB/Sqlite.hs +++ b/src/Cardano/Wallet/Kernel/DB/Sqlite.hs @@ -355,7 +355,7 @@ newConnection path = Sqlite.open path -- | Closes an open 'Connection' to the @Sqlite@ database stored in the -- input 'MetaDBHandle'. -- Even if open failed with error, this function should be called http://www.sqlite.org/c3ref/open.html --- TODO: provide a brucket style interface to ensure this. +-- TODO: provide a bracket style interface to ensure this. closeMetaDB :: Sqlite.Connection -> IO () closeMetaDB = Sqlite.close diff --git a/src/Cardano/Wallet/Kernel/DB/TxMeta/Types.hs b/src/Cardano/Wallet/Kernel/DB/TxMeta/Types.hs index 9434d2f6b91..a2be4a818ef 100644 --- a/src/Cardano/Wallet/Kernel/DB/TxMeta/Types.hs +++ b/src/Cardano/Wallet/Kernel/DB/TxMeta/Types.hs @@ -73,8 +73,6 @@ data TxMeta = TxMeta { _txMetaId :: Txp.TxId -- | Total amount - -- - -- TODO: What does this mean? , _txMetaAmount :: Core.Coin -- | Transaction inputs diff --git a/src/Cardano/Wallet/Kernel/Mode.hs b/src/Cardano/Wallet/Kernel/Mode.hs index 27b607c83cb..e13db99be1e 100644 --- a/src/Cardano/Wallet/Kernel/Mode.hs +++ b/src/Cardano/Wallet/Kernel/Mode.hs @@ -61,27 +61,21 @@ getWallet = view wcWallet_L -------------------------------------------------------------------------------} -- | Callback for new blocks --- --- TODO: This should wrap the functionality in "Cardano.Wallet.Core" to --- wrap things in Cardano specific types. walletApplyBlocks :: PassiveWalletLayer IO -> OldestFirst NE Blund -> WalletMode SomeBatchOp -walletApplyBlocks _w _bs = do - lift $ applyBlocks _w _bs +walletApplyBlocks w bs = do + lift $ applyBlocks w bs -- We don't make any changes to the DB so we always return 'mempty'. return mempty -- | Callback for rollbacks --- --- TODO: This should wrap the functionality in "Cardano.Wallet.Core" to --- wrap things in Cardano specific types. walletRollbackBlocks :: PassiveWalletLayer IO -> NewestFirst NE Blund -> WalletMode SomeBatchOp -walletRollbackBlocks _w _bs = do - lift $ rollbackBlocks _w _bs +walletRollbackBlocks w bs = do + lift $ rollbackBlocks w bs -- We don't make any changes to the DB so we always return 'mempty'. return mempty diff --git a/src/Cardano/Wallet/Server.hs b/src/Cardano/Wallet/Server.hs index 14680022746..93dfc8fab43 100644 --- a/src/Cardano/Wallet/Server.hs +++ b/src/Cardano/Wallet/Server.hs @@ -31,14 +31,11 @@ walletServer w _ = :<|> v1Handler :<|> internalHandler where - -- TODO: Not sure if we want to support the V0 API with the new wallet. - -- For now I'm assuming we're not going to. - -- -- TODO: It'd be nicer to not throw an exception here, but servant doesn't -- make this very easy at the moment. v0Handler = error "V0 API no longer supported" v1Handler = V1.handlers w - internalHandler = error "Internal API not yet defined" + internalHandler = error "TODO: Internal API not yet defined (CBR-377)" walletDocServer :: (HasCompileInfo, HasUpdateConfiguration) => Server WalletDocAPI