Reserve contest - lukris02's results

A permissionless platform to launch and govern asset-backed stable currencies.

General Information

Platform: Code4rena

Start Date: 06/01/2023

Pot Size: $210,500 USDC

Total HM: 27

Participants: 73

Period: 14 days

Judge: 0xean

Total Solo HM: 18

Id: 203

League: ETH

Reserve

Findings Distribution

Researcher Performance

Rank: 48/73

Findings: 1

Award: $121.59

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

QA Report for Reserve contest

Overview

During the audit, 2 low and 9 non-critical issues were found.

â„–TitleRisk RatingInstance Count
L-1address signer != address(0) not checkedLow1
L-2isContract conditionLow1
NC-1Order of FunctionsNon-Critical15
NC-2Order of LayoutNon-Critical9
NC-3Unused named return variablesNon-Critical13
NC-4Open questionNon-Critical1
NC-5Typos in function argument and variable namesNon-Critical6
NC-6TyposNon-Critical25
NC-7Missing NatSpecNon-Critical5
NC-8One internal constant among public constantsNon-Critical1
NC-9Missing leading underscoresNon-Critical67

Low Risk Findings(2)

L-1. address signer != address(0) not checked

Description

When recover is invoked with an invalid signature, the zero-address is returned by it. With nonce == 0, the require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce"); can be passed.

Instances
Recommendation

Check that address signer != address(0).

L-2. isContract condition

Description

It is unsafe to assume that an address for which isContract function returns false is an externally-owned account (EOA) and not a contract. It also can be a contract in construction, an address where a contract will be created, and an address where a contract lived, but was destroyed.

Instances

Non-Critical Risk Findings(9)

NC-1. Order of Functions

Description

According to Style Guide, ordering helps readers identify which functions they can call and to find the constructor and fallback definitions easier.
Functions should be grouped according to their visibility and ordered:

  1. constructor
  2. receive function (if exists)
  3. fallback function (if exists)
  4. external
  5. public
  6. internal
  7. private
Instances

External functions should not be placed after internalc functions:

External functions should not be placed after public functions:

Public functions should not be placed after private/internal functions:

Recommendation

Reorder functions where possible.

NC-2. Order of Layout

Description

According to Order of Layout, inside each contract, library or interface, use the following order:

  1. Type declarations
  2. State variables
  3. Events
  4. Modifiers
  5. Functions
Instances

Type declarations and state variables should be placed at the beginning of the contract, not between functions:

Events should be placed before all functions:

Modifiers should be placed before all functions:

NC-3. Unused named return variables

Description

Both named return variable(s) and return statement are used.

Instances
Recommendation

To improve clarity use only named return variables.
For example, change:

function functionName() returns (uint id) { return x;

to

function functionName() returns (uint id) { id = x;

NC-4. Open question

Instances
Recommendation

Resolve the question.

NC-5. Typos in function argument and variable names

Instances

NC-6. Typos

Instances

NC-7. Missing NatSpec

Instances
Recommendation

Add NatSpec for all functions.

NC-8. One internal constant among public constants

Description

Here, all constants are public except for EIP712_DOMAIN:

bytes public constant EIP712_REVISION = bytes("1"); bytes32 internal constant EIP712_DOMAIN = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); bytes32 public constant PERMIT_TYPEHASH = keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ); bytes32 public constant METADEPOSIT_TYPEHASH = keccak256( "Deposit(address depositor,address recipient,uint256 value,uint16 referralCode,bool fromUnderlying,uint256 nonce,uint256 deadline)" ); bytes32 public constant METAWITHDRAWAL_TYPEHASH = keccak256( "Withdraw(address owner,address recipient,uint256 staticAmount,uint256 dynamicAmount,bool toUnderlying,uint256 nonce,uint256 deadline)" );
Instances
Recommendation

Make bytes32 internal constant EIP712_DOMAIN public.

Recommendation

Make the lines shorter.

NC-9. Missing leading underscores

Description

Internal and private constants, variables and functions should have a leading underscore, public - should not:

Instances

Remove _ from public mapping:

Add _ to private/internal functions:

Add _ to private/internal constants/variables:

Recommendation

Add and remove leading underscores where needed.

#0 - c4-judge

2023-01-25T00:00:45Z

0xean marked the issue as grade-b

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter