Platform: Code4rena
Start Date: 12/07/2022
Pot Size: $35,000 USDC
Total HM: 13
Participants: 78
Period: 3 days
Judge: 0xean
Total Solo HM: 6
Id: 135
League: ETH
Rank: 74/78
Findings: 1
Award: $25.72
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: joestakey
Also found by: 0x040, 0x1f8b, 0xDjango, 0xNazgul, 0xsam, Avci, Aymen0909, Bnke0x0, CRYP70, ElKu, Fitraldys, Funen, JC, Kaiziron, MadWookie, Meera, ReyAdmirado, Sm4rty, Soosh, TomJ, Waze, _Adam, __141345__, ajtra, benbaessler, c3phas, csanuragjain, durianSausage, exd0tpy, fatherOfBlocks, hake, ignacio, karanctf, kyteg, m_Rassska, oyc_109, rbserver, robee, rokinot, samruna, sashik_eth, simon135, slywaters
25.7152 USDC - $25.72
When using elements that are smaller than 32 bytes, your contract’s gas usage may be higher. This is because the EVM operates on 32 bytes at a time. Therefore, if the element is smaller than that, the EVM must use more operations in order to reduce the size of the element from 32 bytes to the desired size.
resource :Â https://docs.soliditylang.org/en/v0.8.11/internals/layout_in_storage.html
Use a larger size then downcast where needed
POC : https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L15 https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L578 https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L600 https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L620 https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L634