VTVL contest - lukris02's results

Building no-code token management tools to empower web3 founders and investors, starting with token vesting.

General Information

Platform: Code4rena

Start Date: 20/09/2022

Pot Size: $30,000 USDC

Total HM: 12

Participants: 198

Period: 3 days

Judge: 0xean

Total Solo HM: 2

Id: 164

League: ETH

VTVL

Findings Distribution

Researcher Performance

Rank: 62/198

Findings: 2

Award: $46.35

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

QA Report for VTVL contest

Overview

During the audit, 1 low and 8 non-critical issues were found.

β„–TitleRisk RatingInstance Count
L-1Large number of elements may cause out-of-gas errorLow1
NC-1Order of FunctionsNon-Critical5
NC-2Order of LayoutNon-Critical3
NC-3Floating pragmaNon-Critical1
NC-4TypoNon-Critical1
NC-5Public functions can be externalNon-Critical2
NC-6Missing NatSpecNon-Critical2
NC-7Open TODONon-Critical1
NC-8Maximum line length exceededNon-Critical5

Low Risk Findings (1)

L-1. Large number of elements may cause out-of-gas error

Description

Loops that do not have a fixed number of iterations, for example, loops that depend on storage values, have to be used carefully: Due to the block gas limit, transactions can only consume a certain amount of gas. Either explicitly or just due to normal operation, the number of iterations in a loop can grow beyond the block gas limit, which can cause the complete contract to be stalled at a certain point.

Instances
Recommendation

Restrict the maximum number of elements.

Non-Critical Risk Findings (8)

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
  1. internal function before public
  2. public functions before external and (2), (3)
  3. private function before external
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 constructor.

NC-3. Floating pragma

Description

Contracts should be deployed with the same compiler version. It helps to ensure that contracts do not accidentally get deployed using, for example, an outdated compiler version that might introduce bugs that affect the contract system negatively.

Instances
Recommendation

According to SWC-103, pragma version should be locked.

NC-4. Typo

Description

Typo in the comment.

Instances

// Next, we need to calculated the duration truncated to nearest releaseIntervalSecs

Recommendation

Change to:
"// Next, we need to calculate the duration truncated to nearest releaseIntervalSecs"

NC-5. Public functions can be external

Description

If functions are not called by the contract where they are defined, they can be declared external.

Instances
Recommendation

Make public functions external, where possible.

NC-6. Missing NatSpec

Instances
Recommendation

Add NatSpec for all functions.

NC-7. Open TODO

Instances
Recommendation

Resolve issues.

NC-8. Maximum line length exceeded

Description

Some lines of code are too long.

Instances
Recommendation

According to Style Guide, maximum suggested line length is 120 characters.
Make the lines shorter.

Awards

9.086 USDC - $9.09

Labels

bug
G (Gas Optimization)

External Links

Gas Optimizations Report for VTVL Finance contest

Overview

During the audit, 6 gas issues were found.

Gas Optimizations Findings (6)

G-1. Postfix increment

Description

Prefix increment costs less gas than postfix.

Instances
Recommendation

Consider using prefix increment where it is relevant.

G-2. Initializing variables with default value

Description

It costs gas to initialize integer variables with 0 or bool variables with false but it is not necessary.

Instances
Recommendation

Remove initialization for default values.
For example: for (uint256 i; i < array.length; ++i) {

G-3. > 0 is more expensive than =! 0

Instances
Recommendation

Use =! 0 instead of > 0, where possible.

G-4. x += y is more expensive than x = x + y

Instances
Recommendation

Use x = x + y instead of x += y. Use x = x - y instead of x -= y.

G-5. Using unchecked blocks saves gas

Description

In Solidity 0.8+, there’s a default overflow and underflow check on unsigned integers. When an overflow or underflow isn’t possible, some gas can be saved by using unchecked blocks.

Instances
Recommendation

Change:

for (uint256 i; i < n; ++i) { // ... }

to:

for (uint256 i; i < n;) { // ... unchecked { ++i; } }

G-6. Custom errors may be used

Description

Custom errors from Solidity 0.8.4 are cheaper than revert strings.

Instances
Recommendation

For example, change:

require(address(_tokenAddress) != address(0), "INVALID_ADDRESS");

to:

error InvalidAddress(); ... if (address(_tokenAddress) == address(0)) revert InvalidAddress();
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