Yield Witch v2 contest - Chom's results

Fixed-rate borrowing and lending on Ethereum

General Information

Platform: Code4rena

Start Date: 14/07/2022

Pot Size: $25,000 USDC

Total HM: 2

Participants: 63

Period: 3 days

Judge: PierrickGT

Total Solo HM: 1

Id: 147

League: ETH

Yield

Findings Distribution

Researcher Performance

Rank: 19/63

Findings: 2

Award: $59.48

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

42.6142 USDC - $42.61

Labels

bug
QA (Quality Assurance)

External Links

Underflow risk of elapsed = uint32(block.timestamp) - uint256(auction_.start);

https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L581-L583

unchecked { elapsed = uint32(block.timestamp) - uint256(auction_.start); // Overflow on block.timestamp is fine }

if uint256(auction_.start) > uint32(block.timestamp), elapsed will be underflow.

You should use larger than uint32 to store timestamp

type(uint32).max = 4294967295 which is Sunday, February 7, 2106 6:28:15

This mean that if you use uint32 to store timestamp, your program only work until Sunday, February 7, 2106 6:28:15 and there aren't any idea proposed on how to migrate beyond that date.

#0 - alcueca

2022-07-22T14:41:05Z

This mean that if you use uint32 to store timestamp, your program only work until Sunday, February 7, 2106 6:28:15 and there aren't any idea proposed on how to migrate beyond that date.

Not sure if sarcasm. One useful.

Consider using custom errors instead of revert strings

This reduce gas cost as show here https://forum.openzeppelin.com/t/a-collection-of-gas-optimisation-tricks/19966/5

Solidity 0.8.4 introduced custom errors. They are more gas efficient than revert strings, when it comes to deployment cost as well as runtime cost when the revert condition is met. Use custom errors instead of revert strings for gas savings.

Any require statement in your code can be replaced with custom error for example,

https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L395

require(ilkJoin != IJoin(address(0)), "Join not found");

Can be replaced with

// declare error before contract declaration error JoinNotFound(); if (ilkJoin != IJoin(address(0)) revert JoinNotFound();
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