Skip to content

Commit

Permalink
Remove debugging statements
Browse files Browse the repository at this point in the history
  • Loading branch information
mdimjasevic committed Feb 2, 2023
1 parent 60789ce commit 2b3257c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 23 deletions.
7 changes: 2 additions & 5 deletions services/brig/src/Brig/Data/MLS/KeyPackage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import Data.Id
import Data.Qualified
import Data.Time.Clock
import Data.Time.Clock.POSIX
import Debug.Trace
import Imports
import Wire.API.MLS.Credential
import Wire.API.MLS.KeyPackage
Expand Down Expand Up @@ -187,8 +186,7 @@ keyPackageRefSetConvId ref convId = do
q = "UPDATE mls_key_package_refs SET conv_domain = ?, conv = ? WHERE ref = ? IF EXISTS"

addKeyPackageRef :: MonadClient m => KeyPackageRef -> NewKeyPackageRef -> m ()
addKeyPackageRef ref nkpr = do
traceM ("addKeyPackageRef " <> show ref)
addKeyPackageRef ref nkpr =
retry x5 $
write
q
Expand All @@ -205,13 +203,12 @@ addKeyPackageRef ref nkpr = do
-- FUTUREWORK: this function has to be extended if a table mapping (client,
-- conversation) to key package ref is added, for instance, when implementing
-- external delete proposals.
updateKeyPackageRef :: (MonadClient m) => KeyPackageRef -> KeyPackageRef -> m ()
updateKeyPackageRef :: MonadClient m => KeyPackageRef -> KeyPackageRef -> m ()
updateKeyPackageRef prevRef newRef =
void . runMaybeT $ do
backup <- backupKeyPackageMeta prevRef
lift $ do
restoreKeyPackageMeta newRef backup
traceM ("updateKeyPackageRef: calling deleteKeyPackage with ref " <> show prevRef)
deleteKeyPackage prevRef

--------------------------------------------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions services/galley/src/Galley/API/MLS/Message.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module Galley.API.MLS.Message
where

import Control.Arrow ((>>>))
import Debug.Trace
import Control.Comonad
import Control.Error.Util (hush)
import Control.Lens (forOf_, preview)
Expand Down Expand Up @@ -476,9 +475,7 @@ getSenderClient qusr SMLSPlainText msg = case msgSender msg of
PreconfiguredSender _ -> pure Nothing
NewMemberSender -> pure Nothing
MemberSender ref -> do
traceM "getSenderClient before"
cid <- derefKeyPackage ref
traceM "getSenderClient after"
when (fmap fst (cidQualifiedClient cid) /= qusr) $
throwS @'MLSClientSenderUserMismatch
pure (Just (ciClient cid))
Expand Down Expand Up @@ -822,9 +819,7 @@ processExternalCommit qusr mSenderClient lConvOrSub epoch action updatePath = wi
unless (user == u) $
throwS @'MLSClientSenderUserMismatch
ref <- ensureSingleton clients
traceM "derefUser before"
ci <- derefKeyPackage ref
traceM "derefUser after"
unless (cidQualifiedUser ci == user) $
throwS @'MLSClientSenderUserMismatch
pure (ci, ref)
Expand Down Expand Up @@ -1078,9 +1073,7 @@ applyProposal convOrSubConvId groupId (AddProposal kp) = do
addMLSClients groupId qusr (Set.singleton (ciClient cid, ref))
pure cid
applyProposal _convOrSubConvId _groupId (RemoveProposal ref) = do
traceM "applyProposal before"
qclient <- cidQualifiedClient <$> derefKeyPackage ref
traceM "applyProposal after"
pure (paRemoveClient ((,ref) <$$> qclient))
applyProposal _convOrSubConvId _groupId (ExternalInitProposal _) =
-- only record the fact there was an external init proposal, but do not
Expand Down
8 changes: 1 addition & 7 deletions services/galley/src/Galley/API/MLS/Welcome.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import Data.Id
import Data.Json.Util
import Data.Qualified
import Data.Time
import Debug.Trace
import Galley.API.MLS.Enabled
import Galley.API.MLS.KeyPackage
import Galley.API.Push
Expand Down Expand Up @@ -111,12 +110,7 @@ welcomeRecipients ::
welcomeRecipients =
traverse
( fmap cidQualifiedClient
. ( \x -> do
traceM "welcomeRecipients before"
res <- derefKeyPackage x
traceM "welcomeRecipients after"
pure res
)
. derefKeyPackage
. gsNewMember
)
. welSecrets
Expand Down
5 changes: 1 addition & 4 deletions services/galley/test/integration/API/MLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import Data.Singletons
import Data.String.Conversions
import qualified Data.Text as T
import Data.Time
import Debug.Trace
import Federator.MockServer hiding (withTempMockFederator)
import Imports
import qualified Network.Wai.Utilities.Error as Wai
Expand Down Expand Up @@ -1594,7 +1593,7 @@ testBackendRemoveProposalRecreateClient = do
void $ createPendingProposalCommit alice1 >>= sendAndConsumeCommitBundle

(_, ref) <- assertOne =<< getClientsFromGroupState alice1 alice
traceM ("test: the ref " <> show ref)

liftTest $
deleteClient (qUnqualified alice) (ciClient alice1) (Just defPassword)
!!! const 200 === statusCode
Expand All @@ -1612,8 +1611,6 @@ testBackendRemoveProposalRecreateClient = do
wsAssertBackendRemoveProposal alice qcnv ref

consumeMessage1 alice2 proposal

-- this fails with 404 mls-key-package-ref-not-found
void $ createPendingProposalCommit alice2 >>= sendAndConsumeCommitBundle

void $ createApplicationMessage alice2 "hello" >>= sendAndConsumeMessage
Expand Down

0 comments on commit 2b3257c

Please sign in to comment.