xTRIBE contest - Funen's results

A TRIBE tokenomic upgrade with multi-delegation, autocompounding rewards, and reward delegation

General Information

Platform: Code4rena

Start Date: 21/04/2022

Pot Size: $75,000 USDC

Total HM: 7

Participants: 45

Period: 7 days

Judge: 0xean

Total Solo HM: 5

Id: 111

League: ETH

Tribe

Findings Distribution

Researcher Performance

Rank: 40/45

Findings: 1

Award: $67.07

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

67.0735 USDC - $67.07

Labels

bug
G (Gas Optimization)
sponsor acknowledged

External Links

  1. Reorder Struct for saving more gas

https://github.com/fei-protocol/flywheel-v2/blob/77bfadf388db25cf5917d39cd9c0ad920f404aad/src/token/ERC20Gauges.sol#L52

This implementation below can saving more gas instead

##Recommendation Mitigation

struct Weight { uint32 currentCycle; uint112 storedWeight; uint112 currentWeight; }
  1. change uint256 i = 0 into uint i for saving more gas

using this implementation can saving more gas for each loops.

##Tool Used Manual Review

##Recommended Mitigation Change it

##Occurances

src/token/ERC20MultiVotes.sol#L346 src/token/ERC20Gauges.sol#L134 src/token/ERC20Gauges.sol#L184 src/token/ERC20Gauges.sol#L307 src/token/ERC20Gauges.sol#L384 src/token/ERC20Gauges.sol#L564
  1. Saving gas by removing = 0

https://github.com/fei-protocol/flywheel-v2/blob/77bfadf388db25cf5917d39cd9c0ad920f404aad/src/token/ERC20MultiVotes.sol#L354

If a variable was not set/initialized, it is assumed to have default value to 0 this implementation was used for saving more gas by removing = 0

##TOOLS USED Manual Review

##Mitigation Step Remove = 0

#0 - thomas-waite

2022-07-14T15:52:36Z

Much prefer explicitly sized variables over uint even if it does cost a bit more gas. How does that struct difference save gas?

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