Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
gitbe: Duplicate votes in the votes journal #882
15 duplicate votes made it into the votes journal of the Decentralized Treasury Spending proposal. The bug that allowed for this has existed since Politeia launched, but this is the first time that any duplicate votes made it into the politeiad git repo for any proposal. politeiad replays all vote journals on startup and explicitly checks for duplicate votes. This allowed for the bug to be caught as soon a the first duplicate vote made it into the repo.
politeiad has a memory cache of all cast votes. When a user casts a vote, politeiad checks the memory cache to see if the vote already exists. If it does not exist, the vote is writen to the votes journal then added to the memory cache. This memory cache read/write operation was not atomic. If a user submitted the same vote request multiple times, concurrently, it was possible for a duplicate vote to be added to the votes journal before the memory cache was properly updated.
Found an answer to my previous question in #893 :