Canto contest - abiih's results

Execution layer for original work.

General Information

Platform: Code4rena

Start Date: 23/11/2022

Pot Size: $24,500 CANTO

Total HM: 5

Participants: 37

Period: 5 days

Judge: berndartmueller

Total Solo HM: 2

Id: 185

League: ETH

Canto

Findings Distribution

Researcher Performance

Rank: 32/37

Findings: 1

Award: $13.69

Gas:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

84.7394 CANTO - $13.69

Labels

bug
G (Gas Optimization)
grade-b
G-20

External Links

Report


Gas Optimizations


IssueInstancesTotal Gas Saved on Deployment[Estimated]
GAS-1Use global variable msg.sender directly without caching34760
GAS-2Strict inequalities are expensive than Non-strict ones1216

Total: 4 instances over 2 issues with estimated 4976 gas saved on deployment.

[GAS-1] Use global variable msg.sender directly without caching

It is cheaper to use the global variable msg.sender directly rather than caching it. We can save about 4760 in gas at deployment and also save gas on every call.

File: /CIP-001/src/Turnstile.sol 50: address smartContract = msg.sender; 87: address smartContract = msg.sender; 108: address smartContract = msg.sender;
Mitigation

Use the msg.sender directly

[GAS-2] Strict inequalities are more expensive than Non-strict ones

Non-strict inequalities (>=) are cheaper than strict ones (>). This is so as strict inequalities add a check of nonequality which costs around 3 gas.

File: /CIP-001/src/Turnstile.sol 135: if (_amount > earnedFees) _amount = earnedFees;
Mitigation
File: /CIP-001/src/Turnstile.sol 135: if (_amount >= earnedFees) _amount = earnedFees;

#0 - c4-judge

2022-11-29T19:20:01Z

berndartmueller marked the issue as grade-b

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