FIAT DAO veFDT contest - 0xackermann's results

Unlock liquidity for your DeFi fixed income assets.

General Information

Platform: Code4rena

Start Date: 12/08/2022

Pot Size: $35,000 USDC

Total HM: 10

Participants: 126

Period: 3 days

Judge: Justin Goro

Total Solo HM: 3

Id: 154

League: ETH

FIAT DAO

Findings Distribution

Researcher Performance

Rank: 122/126

Findings: 1

Award: $14.95

🌟 Selected for report: 0

🚀 Solo Findings: 0

Gas Report

Use != 0 instead of > 0 for Unsigned Integer Comparison

Locations:

Blocklist.sol::42 => return size > 0; VotingEscrow.sol::176 => if (delegatee != _addr && value > 0) { VotingEscrow.sol::236 => if (_oldLocked.end > block.timestamp && _oldLocked.delegated > 0) { VotingEscrow.sol::244 => if (_newLocked.end > block.timestamp && _newLocked.delegated > 0) { VotingEscrow.sol::288 => if (epoch > 0) { VotingEscrow.sol::412 => require(_value > 0, "Only non zero amount"); VotingEscrow.sol::448 => require(_value > 0, "Only non zero amount"); VotingEscrow.sol::449 => require(locked_.amount > 0, "No lock"); VotingEscrow.sol::469 => require(locked_.amount > 0, "Delegatee has no lock"); VotingEscrow.sol::502 => require(locked_.amount > 0, "No lock"); VotingEscrow.sol::529 => require(locked_.amount > 0, "No lock"); VotingEscrow.sol::564 => require(locked_.amount > 0, "No lock"); VotingEscrow.sol::587 => require(toLocked.amount > 0, "Delegatee has no lock"); VotingEscrow.sol::621 => if (newLocked.amount > 0) { VotingEscrow.sol::635 => require(locked_.amount > 0, "No lock");

Impact

It is cheaper to deal with unsigned integers by using != 0 than > 0.


Use Shift Right/Left instead of Division/Multiplication if possible

Locations:

VotingEscrow.sol::719 => uint256 mid = (min + max + 1) / 2; VotingEscrow.sol::743 => uint256 mid = (min + max + 1) / 2;

Impact

It costs cheaper to use >> 1 instead of dividing by 2.


Need to Have Specific Compiler Version for Pragma

Locations:

Blocklist.sol::2 => pragma solidity ^0.8.3; IBlocklist.sol::2 => pragma solidity ^0.8.3; IERC20.sol::2 => pragma solidity ^0.8.3; IERC20Permit.sol::4 => pragma solidity ^0.8.3; IVotingEscrow.sol::2 => pragma solidity ^0.8.3; VotingEscrow.sol::2 => pragma solidity ^0.8.3;

Impact

It is suggested to use a concrete compiler version. This is because a new version compiler may be vulnerable and cause fall back in older version of compiler.

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