MyCut

First Flight #23
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

Using unbounded loops updating state variables of contract in `Pot::constructor`. Transaction will revert if the loop iteration hit the block's gas limit.

Description:

In constructor of Pot contract, there is a for loop through i_players array and modify playersToRewards mapping (a state variable) inside it, those work will consume a lot of gas, and the longer of i_players array is, the more gas have to spend for this transaction.

Impact:

If the loop consuming more gas than the block's gas limit, the transaction will revert.

Tools Used:

Manual review

Recommendations:

The owner must pass in the i_players array with the length a loop can execute.

Updates

Lead Judging Commences

equious Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Unbound for loop in Contest Creation

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.