Ethos Reserve contest - lukris02's results

A CDP-backed stablecoin platform designed to generate yield on underlying assets to establish a sustainable DeFi stable interest rate.

General Information

Platform: Code4rena

Start Date: 16/02/2023

Pot Size: $144,750 USDC

Total HM: 17

Participants: 154

Period: 19 days

Judge: Trust

Total Solo HM: 5

Id: 216

League: ETH

Ethos Reserve

Findings Distribution

Researcher Performance

Rank: 114/154

Findings: 1

Award: $61.26

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

QA Report for Ethos Reserve contest

Overview

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

â„–TitleRisk RatingInstance Count
L-1Check multisigRoles.length in ReaperVaultV2Low1
L-2Some events could be more informativeLow4
NC-1Order of FunctionsNon-Critical10
NC-2Order of LayoutNon-Critical1
NC-3Missing leading underscoresNon-Critical12
NC-4Inconsistency when using uint and uint256Non-Critical5
NC-5Unused named return variablesNon-Critical13
NC-6Inconsistency when using the number 10000Non-Critical1
NC-7Visibility is not setNon-Critical5
NC-8Wrong modifier order in function declarationNon-Critical2
NC-9Missing NatSpecNon-Critical4
NC-10Incomplete NatSpecNon-Critical1
NC-11No space between the control structuresNon-Critical3
NC-12Maximum line length exceededNon-Critical42

Low Risk Findings(2)

L-1. Check multisigRoles.length in ReaperVaultV2

Description

Function __ReaperBaseStrategy_init checks that multisigRoles.length == 3 before granting roles:

require(_multisigRoles.length == 3, "Invalid number of multisig roles"); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(DEFAULT_ADMIN_ROLE, _multisigRoles[0]); _grantRole(ADMIN, _multisigRoles[1]); _grantRole(GUARDIAN, _multisigRoles[2]);

But in ReaperVaultV2 constructor, there is no such check.

Instances
Recommendation

In ReaperVaultV2 constructor, it is better to also check the multisigRoles.length:

require(_multisigRoles.length == 3, "Invalid number of multisig roles");

L-2. Some events could be more informative

Description

Some events in setters functions emit only new set values, but it may be more convenient to emit old values as well.

Instances
Recommendation

It is better to add info about previous values in the events. For example:

emit YieldingPercentageUpdated(_collateral, _previous_bps, _new_bps);

Non-Critical Risk Findings(12)

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 can not go after public functions:

Public function can not go after internal function:

External functions can not go after public and 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
Recommendation

Place modifiers before functions.

NC-3. Missing leading underscores

Description

Internal and private constants, state variables, and functions should have a leading underscore.

Instances
Recommendation

Add leading underscores where needed.

NC-4. Inconsistency when using uint and uint256

Description

Some variables is declared as uint and some as uint256.

Instances
Recommendation

Stick to one style.

NC-5. 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-6. Inconsistency when using the number 10000

Description

In some cases, 10000 is used, and in some - 10_000.

Instances

Here 10000:

While in other cases - 10_000, for example:

Recommendation

Stick to one style.

NC-7. Visibility is not set

Instances
Recommendation

It is better to specify visibility explicitly.

NC-8. Wrong modifier order in function declaration

Description

According to Style Guide, the modifier order for a function should be:

  1. Visibility
  2. Mutability
  3. Virtual
  4. Override
  5. Custom modifiers
Instances
Recommendation

Change pure internal to internal pure.

NC-9. Missing NatSpec

Description

NatSpec is missing for all functions in 4 contracts.

Instances
Recommendation

Add NatSpec for all functions.

NC-10. Incomplete NatSpec

Description

Not all parameters have a description, which complicates the understanding of the code.

Instances
Recommendation

Add a description for _treasury, _strategists, and _multisigRoles.

NC-11. No space between the control structures

Description

According to Style Guide, there should be a single space between the control structures if, while, and for and the parenthetic block representing the conditional.

Instances
Recommendation

Change:

for(...) { ... }

to:

for (...) { ... }

NC-12. Maximum line length exceeded

Description

According to Style Guide, maximum suggested line length is 120 characters. Longer lines make the code harder to read.

Instances
Recommendation

Make the lines shorter.

#0 - c4-judge

2023-03-09T11:12:49Z

trust1995 marked the issue as grade-b

#1 - c4-sponsor

2023-03-18T00:10:46Z

0xBebis marked the issue as sponsor confirmed

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