hats-finance / Proof-Of-Humanity-V2-0xef0709445d394a22704850c772a28a863bb780b0

Proof of Humanity Protocol v2
2 stars 1 forks source link

Stop Using v == 27 || v == 28 #25

Open hats-bug-reporter[bot] opened 3 weeks ago

hats-bug-reporter[bot] commented 3 weeks ago

Github username: -- Twitter username: dod4ufn Submission hash (on-chain): 0x28e7489aaa6f851dab0f1ef245b5887370a9d7572b54056fe109248e2e373a35 Severity: low

Description: Description\

The usage of v == 27 || v == 28 is not suggested. This issue has been successfully submitted in other contests and considered a valid low.

Reference: https://code4rena.com/reports/2022-11-non-fungible#n-11-stop-using-v--27--v--28-or-v--27--v--28

  1. Proof of Concept (PoC)

In the ProofOfHumanityOld file:

if (v < 27) v += 27;
    require(v == 27 || v == 28, "Invalid signature");
clesaege commented 3 weeks ago

So looking at the reference of your reference it is in order to save gas (this being also checked by the precompile).

As per the contest rules, the following are out of scope: Gas optimization.