President Elector

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

`TYPEHASH` Constant is set to the wrong value

Summary

The TYPEHASH constant is set to the wrong value and will cause the rankCandidatesBySig function to not work correctly once it is called.

Vulnerability Details

The TYPEHASH constant is set below

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

This is the incorrect input parameter for the rankCandidates function. Instead of being type uint256, it should be of type address[].

This constant is used in the rankCandidatesBySig function. It will not work as expected with this wrong input parameter type as the hashed value will be incorrect.

Tools Used

--Foundry

Recommendations

It is recommended to change the input parameter type when setting the TYPEHASH constant.

-bytes32 public constant TYPEHASH = keccak256("rankCandidates(uint256[])");
+bytes32 public constant TYPEHASH = keccak256("rankCandidates(address[])");
Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months 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.