President Elector

First Flight #24
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Valid

TYPEHASH has Incorrect Variable Type

Summary

The TYPEHASH variable (RankedChoice.sol::Line 23) should not be a uint[] but an address[]. In this contract, a vote ranks a list of candidates.

Vulnerability Details

bytes32 public constant TYPEHASH = keccak256("rankCandidates(uint256[])"); //@audit - TYPEHASH Missing Address Member (candidate).

Impact

The current implementation prevents a signer from ranking candidates by address. It only allows a order ranking of uints without any candidate corresponding to each ranking.

Tools Used

Manual Review

Recommendations

The TYPEHASH variable should be:

bytes32 public constant TYPEHASH = keccak256("rankCandidates(address[])");

It should not be:

bytes32 public constant TYPEHASH = keccak256("rankCandidates(uint256[])");

The address[] allows the signer to rank specific candidates.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Typehash hashes the wrong function input.

Support

FAQs

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