Skip to content

Commit 3b24d85

Browse files
committed
Revert "Refresh pending proposals"
This reverts commit 70a607f.
1 parent 70a607f commit 3b24d85

File tree

3 files changed

+12
-42
lines changed

3 files changed

+12
-42
lines changed

services/galley/src/Galley/API/MLS/Message.hs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -710,17 +710,15 @@ processCommitWithAction qusr senderClient con lconv cm epoch groupId action send
710710
(_, Nothing) -> pure $ pure () -- ignore commits without update path
711711
_ -> throw (mlsProtocolError "Unexpected sender")
712712

713-
if sender == NewMemberSender
714-
then -- check if an external commit
715-
validateExternalCommit qusr action
716-
else do
717-
-- check all pending proposals are referenced in the commit
718-
allPendingProposals <- getAllPendingProposals groupId epoch
719-
let referencedProposals =
720-
Set.fromList $
721-
mapMaybe (\x -> preview Proposal._Ref x) (cProposals commit)
722-
unless (all (`Set.member` referencedProposals) allPendingProposals) $
723-
throwS @'MLSCommitMissingReferences
713+
-- check all pending proposals are referenced in the commit
714+
allPendingProposals <- getAllPendingProposals groupId epoch
715+
let referencedProposals = Set.fromList $ mapMaybe (\x -> preview Proposal._Ref x) (cProposals commit)
716+
unless (all (`Set.member` referencedProposals) allPendingProposals) $
717+
throwS @'MLSCommitMissingReferences
718+
719+
-- check if an external commit
720+
when (sender == NewMemberSender) $
721+
validateExternalCommit qusr action
724722

725723
-- process and execute proposals
726724
updates <- executeProposalAction qusr con lconv cm action
@@ -735,9 +733,6 @@ processCommitWithAction qusr senderClient con lconv cm epoch groupId action send
735733
. toOpaquePublicGroupState
736734
. gipGroupState
737735

738-
when (sender == NewMemberSender) $
739-
refreshPendingProposals groupId epoch
740-
741736
pure updates
742737

743738
validateExternalCommit ::

services/galley/src/Galley/Cassandra/Proposal.hs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ interpretProposalStoreToCassandra =
4747
GetProposal groupId epoch ref ->
4848
runIdentity <$$> retry x1 (query1 getQuery (params LocalQuorum (groupId, epoch, ref)))
4949
GetAllPendingProposals groupId epoch ->
50-
fst <$$> retry x1 (query getAllPending (params LocalQuorum (groupId, epoch)))
51-
RefreshPendingProposals groupId epoch -> refreshProposals groupId epoch
50+
runIdentity <$$> retry x1 (query getAllPending (params LocalQuorum (groupId, epoch)))
5251

5352
storeQuery :: Timeout -> PrepQuery W (GroupId, Epoch, ProposalRef, RawMLS Proposal) ()
5453
storeQuery ttl =
@@ -60,22 +59,5 @@ storeQuery ttl =
6059
getQuery :: PrepQuery R (GroupId, Epoch, ProposalRef) (Identity (RawMLS Proposal))
6160
getQuery = "select proposal from mls_proposal_refs where group_id = ? and epoch = ? and ref = ?"
6261

63-
getAllPending :: PrepQuery R (GroupId, Epoch) (ProposalRef, RawMLS Proposal)
64-
getAllPending = "select ref, proposal from mls_proposal_refs where group_id = ? and epoch = ?"
65-
66-
refreshProposals :: GroupId -> Epoch -> Client ()
67-
refreshProposals groupId epoch = do
68-
props <- retry x1 (query getAllPending (params LocalQuorum (groupId, epoch)))
69-
retry x5 . batch $ do
70-
setType BatchLogged
71-
setConsistency LocalQuorum
72-
-- insert each proposal with a bumped epoch
73-
for_ props $ \p ->
74-
addPrepQuery
75-
(storeQuery defaultTTL)
76-
(groupId, succ epoch, fst p, snd p)
77-
-- remove old proposals
78-
addPrepQuery removeOld (groupId, epoch)
79-
where
80-
removeOld :: PrepQuery W (GroupId, Epoch) ()
81-
removeOld = "delete from mls_proposal_refs where group_id = ? and epoch = ?"
62+
getAllPending :: PrepQuery R (GroupId, Epoch) (Identity ProposalRef)
63+
getAllPending = "select ref from mls_proposal_refs where group_id = ? and epoch = ?"

services/galley/src/Galley/Effects/ProposalStore.hs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,5 @@ data ProposalStore m a where
4242
GroupId ->
4343
Epoch ->
4444
ProposalStore m [ProposalRef]
45-
-- | Update pending proposals by increasing the epoch number by one. This is
46-
-- used for external commits because an external committer has no up-to-date
47-
-- view of pending proposals.
48-
RefreshPendingProposals ::
49-
GroupId ->
50-
Epoch ->
51-
ProposalStore m ()
5245

5346
makeSem ''ProposalStore

0 commit comments

Comments
 (0)