Change voting storage in the proposals pallet.
Consider to remove VoteExistsByProposalByVoter double map.
┆Issue is synchronized with this Asana task by Unito
I don't remember why this was useful, but should be reviewed.
was used when casting a vote and with .entries to fetch existing votes for example by council report script.
/// Double map for preventing duplicate votes. Should be cleaned after usage.
https://github.com/Joystream/joystream/pull/152/files#diff-6b6adbb20c1dc8ce3765d673766c8cdc8475a137930fd96cd723b243f68df5d3R128
https://github.com/Joystream/community-repo/blob/b32f13e88aeede145a8e2a8d0e25be7ebd75dec8/scripts/report-generator/src/council.ts#L348
Had another look at this, not obvious why this map can be removed? I mean, it can be replaced by something, like putting the voting map into the Proposal, so that we don't need to have a separate map which can get out of synch, and cleanup happens automatically when proposal is deleted from it's map. This of course does mean we have to restrict how many voters can safely vote on a proposal. Currently, this is fine, as only the council ever votes, but if we ever wanted anyone in the community to vote on certain kinds of critical proposals, then throwing this map away would be a big mistake.
The comment Should be cleaned after usage. also makes me wonder whether this is actually now cleaned up in any way? Don't have time to look, but if it is cleaned up automatically, then we are already abandoning the assumption that iterating over voters
It seems either way, at best this is a nice-to-have simplification for cleaner safer code, which itself can introduce new problems and integration pains, and worst case we would be creating a problem down the road.