Yield Witch v2 contest - durianSausage'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: 63/63

Findings: 1

Award: $16.87

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

gas optimization

G01: COMPARISONS WITH ZERO FOR UNSIGNED INTEGERS

problem

0 is less gas efficient than !0 if you enable the optimizer at 10k AND you’re in a require statement. Detailed explanation with the opcodes https://twitter.com/gzeon/status/1485428085885640706

prof

'Witch.sol', 254, ' require(auction_.start > 0, "Vault not under auction"); 'Witch.sol', 299, ' require(auction_.start > 0, "Vault not under auction"); 'Witch.sol', 357, ' require(auction_.start > 0, "Vault not under auction"); 'Witch.sol', 392, ' if (liquidatorCut > 0) { 'Witch.sol', 397, ' if (auctioneerCut > 0) { 'Witch.sol', 415, ' require(auction_.start > 0, "Vault not under auction");

G02: custom error save more gas

problem

Custom errors from Solidity 0.8.4 are cheaper than revert strings (cheaper deployment cost and runtime cost when the revert condition is met) while providing the same amount of information, as explained https://blog.soliditylang.org/2021/04/21/custom-errors/. Custom errors are defined using the error statement.

prof

'Witch.sol', 83, ' require(param == "ladle", "Unrecognized"); 'Witch.sol', 101, ' require(initialOffer <= 1e18, "InitialOffer above 100%"); 'Witch.sol', 102, ' require(proportion <= 1e18, "Proportion above 100%"); 'Witch.sol', 103, ' require( 'Witch.sol', 107, ' require(proportion >= 0.01e18, "Proportion below 1%"); 'Witch.sol', 188, ' require(cauldron.level(vaultId) < 0, "Not undercollateralized"); 'Witch.sol', 199, ' require(limits_.sum <= limits_.max, "Collateral limit reached"); 'Witch.sol', 254, ' require(auction_.start > 0, "Vault not under auction"); 'Witch.sol', 255, ' require(cauldron.level(vaultId) >= 0, "Undercollateralized"); 'Witch.sol', 299, ' require(auction_.start > 0, "Vault not under auction"); 'Witch.sol', 312, ' require(liquidatorCut >= minInkOut, "Not enough bought"); 'Witch.sol', 327, ' require(baseJoin != IJoin(address(0)), "Join not found"); 'Witch.sol', 357, ' require(auction_.start > 0, "Vault not under auction"); 'Witch.sol', 364, ' require(liquidatorCut >= minInkOut, "Not enough bought"); 'Witch.sol', 394, ' require(ilkJoin != IJoin(address(0)), "Join not found"); 'Witch.sol', 415, ' require(auction_.start > 0, "Vault not under auction"); 'Witch.sol', 436, ' require(

G03: X += Y COSTS MORE GAS THAN X = X + Y FOR STATE VARIABLES

prof

'Witch.sol', 258, ' limits[auction_.ilkId][auction_.baseId].sum -= auction_.ink;

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