xTRIBE contest - djxploit'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: 42/45

Findings: 1

Award: $66.32

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

66.3179 USDC - $66.32

Labels

bug
G (Gas Optimization)

External Links

Gas optimization issue in the for loop of xtribe.sol L95:

[1] Un-necessary initialisation of loop invariant :

Statement uint256 i=0 is not required, because all uninitialised uint variable, by default, are set to 0

[2] ++i is cheaper than i++ for unsigned integer [3] Value of accounts[i] is loaded twice, so instead load the value of accounts[i] once, store it in a local variable and then use it.

So the final optimised for loop is as follows:

for (uint256 i; i < size; ) { uint256 memory acc = accounts[i]; emit DelegateVotesChanged(acc, 0, getVotes(acc)); unchecked { ++i; } }
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