a16z / cicada

A protocol for private on-chain voting, implemented in Solidity.
GNU Affero General Public License v3.0
317 stars 23 forks source link

Protecting against malleability/replay attacks #4

Closed seresistvanandras closed 1 year ago

seresistvanandras commented 1 year ago

Malleability attacks can be devastating for TLPs and their applications. This PR is an easy fix to prevent replaying valid ballots from other users by incorporating the msg.sender in the paramtersHash variable, whenever a Fiat-Shamir challenge is computed. I think, this might not be necessary for the Wesolowski proof, but I also attached it there. Maybe there replayability is rather a feature and not a bug, since we want to allow a single party to compute the VDF proof but to allow anyone to submit that to the chain. This might not be the case if we want to give rewards to incentivize the Wesolowski VDF proof submissions.

moodlezoup commented 1 year ago

oh wait I just realized this breaks the end-to-end test :P https://github.com/a16z/cicada/blob/main/test/CicadaVote.t.sol#L55 Let's fix that before merging

seresistvanandras commented 1 year ago

Yeah, indeed! I will fix the tests soon!