Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Society: Ensure all votes are removed after tally #4666

Merged
merged 2 commits into from
Jan 17, 2020

Conversation

shawntabrizi
Copy link
Member

@shawntabrizi shawntabrizi commented Jan 17, 2020

There is a fringe scenario where a member might be asynchronously removed from the membership pool before a vote is tallied. (i.e. through the Defender lifecycle).

In this case, the votes that this user may have stored will not be cleaned up during the rotation cycles.

In addition to take while iterating over members to calculate votes, we also call remove_all on the vote storage items to really make sure all votes are gone after we have finished tallying.

This fixes the behavior for both Votes and DefenderVotes.

Copy link
Contributor

@andresilva andresilva left a comment

Choose a reason for hiding this comment

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

changes lgtm but I'm not familiar with this module. would appreciate another review.

Copy link
Contributor

@andresilva andresilva left a comment

Choose a reason for hiding this comment

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

maybe add a test for the case where a voter is removed while the tally is open? (don't know how easy that is)

@gavofyork gavofyork merged commit 8de5340 into paritytech:master Jan 17, 2020
@shawntabrizi shawntabrizi deleted the shawntabrizi-patch-society branch January 18, 2020 03:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants