Foundation Drop contest - medikko's results

Foundation is a web3 destination.

General Information

Platform: Code4rena

Start Date: 11/08/2022

Pot Size: $40,000 USDC

Total HM: 8

Participants: 108

Period: 4 days

Judge: hickuphh3

Total Solo HM: 2

Id: 152

League: ETH

Foundation

Findings Distribution

Researcher Performance

Rank: 103/108

Findings: 1

Award: $20.60

🌟 Selected for report: 0

🚀 Solo Findings: 0

Intializing the variables to zero that aren't constant or immutable will cost more gas rather than use default value of zero.

If you not overwritte the default value you will save 8 gas for stack variables and more for storage and memory variables.

There are 8 instances of this issue:

File: /contracts/PercentSplitETH.sol:

115: for (uint256 i = 0; i < _shares.length; ++i) {

135: for (uint256 i = 0; i < shares.length; ++i) {

320: for (uint256 i = 0; i < shares.length; ++i) {
File: /contracts/libraries/BytesLibrary.sol

25:     for (uint256 i = 0; i < 20; ++i) {

44:     for (uint256 i = 0; i < 4; ++i) {
File: /contracts/mixins/shared/MarketFees.sol

126:    for (uint256 i = 0; i < creatorRecipients.length; ++i) {

198:    for (uint256 i = 0; i < creatorShares.length; ++i) {

484:    for (uint256 i = 0; i < creatorRecipients.length; ++i) {

Use of ++i/i++ should be unchecked{++i}/unchecked{i++}in for-loops

Not using a unchecked{++i}/unchecked{i++} will cost more gas because the default compiler overflow and underflow safety checks. This is true from version 0.8.0, code below match that requirments.

There are 2 instances of this issue:

File: /contracts/PercentSplitETH.sol:

115: for (uint256 i = 0; i < _shares.length; ++i) {

320: for (uint256 i = 0; i < shares.length; ++i) {

If you use bit shifting will save some gas

Use of bit shifting operations are more cheap than normal multiplication/division operations.

There are 3 instances of this issue:

File: /contracts/FETH.sol 210: lockupInterval = _lockupDuration / 24; 211: if (lockupInterval * 24 != _lockupDuration || _lockupDuration == 0) {
File: ./contracts/libraries/LockedBalance.sol

100: uint256 lockupMetadata = lockups.lockups[index / 2];

#0 - HardlyDifficult

2022-08-19T15:01:54Z

Don't initialize variables with default values.

Invalid. This optimization technique is no longer applicable with the current version of Solidity.

Use of ++i/i++ should be unchecked{++i}/unchecked{i++}in for-loops

Agree and will fix. But this file was out of scope.

If you use bit shifting will save some gas

Both examples were out of scope.

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