Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,15 @@ proposalsRemoveWithDescendants gais ps@(Proposals omap _roots graph) =
getAllDescendants gai =
case OMap.lookup gai omap of
Nothing -> assert False mempty
Just gas -> withGovActionParent gas mempty $ \govRelationL _ ->
let go acc gpi =
case Map.lookup gpi $ graph ^. govRelationL . pGraphNodesL of
Nothing -> assert False acc
Just (PEdges _parent children) ->
F.foldl' go (Set.map unGovPurposeId children <> acc) children
in go mempty
Just gas -> withGovActionParent gas mempty $ \govRelationL _ selfId ->
let loop !acc [] = acc
loop !acc (curr : rest) =
case Map.lookup curr $ graph ^. govRelationL . pGraphNodesL of
Nothing -> loop acc rest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diverges from the original implementation which does assert False.

Just (PEdges _ children) ->
let newChildren = Set.map unGovPurposeId children
in loop (newChildren <> acc) (Set.toList children ++ rest)
in loop mempty [selfId]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does adding the govPurposeId to the accumulator preserve the original logic? I can't convince myself of it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a property test that tests that the new approach matches the semantics of the old one. It will serve as a good regression tests going into the future as well.


-- | For use in the @`EPOCH`@ rule. Apply the result of
-- @`extractDRepPulsingState`@ to the @`Proposals`@ forest, so that:
Expand Down