People often ask me "How did you learn how to hack?" The answer: by reading. This page is a collection of the blog posts and other articles that I have accumulated over the years of my journey. Enjoy!
svmgov. For the first six weeks on mainnet, this had a bug: any validator could silently erase its own delegators dissenting votes. This could have been used to skew voting results. This is the story of how the bug was found. Full disclosure this is my co-worker that I do like a lot! cast_vote, using its full weight of the stake delegated to it. Delegators can choose to override their validator with cast_vote_override, and vote their stake directly. Since most people don't run their own validator but may want to vote, this helps support those folks. cast_vote_override: validator has voted, and hasn't voted (cached). In the first case, if the validator has already voted, then it'll subtract the users votes from the validator to vote for the other side. In the second case, the votes are cached. When the validator votes, the users votes will later be subtracted from their voting power. cast_vote! So, if a validator has not voted, then can simply choose NOT to vote. This means that they're power doesn't count but their staked users doesn't count either. On the proposal SGP-0002 that only passed with 67%, it would have failed if not for the patch. Pretty neat! To fix this, overridden votes count towards the total immeidately.create_proposal, cast_vote_override, time travel, and finally finalize_proposal triggers this. Since the validator never called cast_vote, this is a major problem.