Skip to content

Conversation

@msaadsbr
Copy link

@msaadsbr msaadsbr commented Feb 5, 2026

This PR addresses the potential for StackSpaceOverflow in the governance cleanup logic. By refactoring getAllDescendants to use an iterative worklist on the heap, we ensure that the blocking epoch transition remains robust regardless of environment stack limits or future changes to proposal deposit parameters. This ensures 'security by design' for the ledger's liveness.

@msaadsbr msaadsbr requested a review from a team as a code owner February 5, 2026 19:27
@lehins
Copy link
Collaborator

lehins commented Feb 6, 2026

Thank you, but PR fails to build

@msaadsbr msaadsbr force-pushed the fix/proposals-recursion-limit branch from 3c09a68 to 4d3518d Compare February 7, 2026 17:07
@msaadsbr msaadsbr force-pushed the fix/proposals-recursion-limit branch from 4d3518d to 378764f Compare February 7, 2026 20:57
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants