President Elector

First Flight #24
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Adding a `getHash` function can simplify the voting by signature process for voters

Summary

To call the RankedChoice::rankCandidatesBySig function, voters need to sign a hashed message along with parameters. They must inspect the contract code to determine which TYPEHASH and parameters are used for signing, which complicates the process and increases the risk of mistakes. Adding a getHash function that takes parameters as input and returns the hashed message would solve these issues.

Impact

Currently, voters must review the contract code to check the TYPEHASH and parameters. There's also a risk that they could sign a message with the wrong function selector (keccak256("rankCandidates(address[])")), preventing them from voting in the election.

Recommendations

Add a getHash function:

+ function getHash(address[] memory orderedCandidates) external view returns (bytes32) {
+ return _hashTypedDataV4(keccak256(abi.encode(TYPEHASH, orderedCandidates)));
+ }
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.