Platform: Code4rena
Start Date: 06/03/2023
Pot Size: $36,500 USDC
Total HM: 8
Participants: 93
Period: 3 days
Judge: cccz
Total Solo HM: 3
Id: 218
League: ETH
Rank: 85/93
Findings: 1
Award: $12.72
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Rolezn
Also found by: 0x1f8b, 0x6980, 0xSmartContract, 0xhacksmithh, 0xnev, Haipls, Inspectah, JCN, LethL, Madalad, MiniGlome, Pheonix, Rageur, RaymondFam, ReyAdmirado, SAAJ, Sathish9098, adriro, air, arialblack14, atharvasama, c3phas, ch0bu, ddimitrov22, descharre, hunter_w3b, igingu, matrix_0wl, rokso, saneryee, schrodinger, slvDev, volodya, yongskiws
12.7206 USDC - $12.72
uint/int
smaller than 32bytes incurs overheadinstances()
File :: src/Lottery.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L36 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L37 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L39
File :: src/LotterySetup.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/LotterySetup.sol#L30-L31
struct
, where appropriate.instances()
File :: src/Lottery.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L37
unchecked
blocks to save gas.Solidity version 0.8+ comes with implicit overflow and underflow checks on unsigned integers. When an overflow or an underflow isn’t possible (as an example, when a comparison is made before the arithmetic operation), some gas can be saved by using an unchecked block. instances()
File :: src/Lottery.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L125 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L172 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L193 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L194 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L205 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L211 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L275
File :: src/LotterySetup.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/LotterySetup.sol#L169
File :: src/RNSourceController.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/RNSourceController.sol#L68
state variable
.Using compound assignment operators for state variable(like state += x, or state -= x) its more expensive than using operator assignment (like state = state + x or, state = state - x) instances()
File :: src/Lottery.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L129 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L173
payable
instances()
File :: src/RNSourceController.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/RNSourceController.sol#L77 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/RNSourceController.sol#L89
instances()
File :: src/Lottery.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L286
instances()
File :: src/LotterySetup.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/LotterySetup.sol#L147
constructor
to payable
could save gas.Saves ~13 gas per instances. instances()
File :: src/Lottery.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L84
public
function instead of modifiers
instances()
File :: src/Lottery.sol https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L44 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L52 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L60 https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L69
#0 - c4-judge
2023-03-12T14:43:33Z
thereksfour marked the issue as grade-b
#1 - c4-sponsor
2023-03-14T13:18:12Z
TutaRicky marked the issue as sponsor acknowledged