Platform: Code4rena
Start Date: 08/06/2022
Pot Size: $115,000 USDC
Total HM: 26
Participants: 72
Period: 11 days
Judge: leastwood
Total Solo HM: 14
Id: 132
League: ETH
Rank: 71/72
Findings: 1
Award: $84.50
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x29A, 0xKitsune, 0xNazgul, 0xf15ers, 0xkatana, 0xmint, BowTiedWardens, ElKu, Fitraldys, Funen, Kaiziron, Lambda, Metatron, MiloTruck, Randyyy, Ruhum, SmartSek, TomJ, Tomio, UnusualTurtle, Waze, _Adam, apostle0x01, asutorufos, c3phas, catchup, csanuragjain, defsec, fatherOfBlocks, hansfriese, hyh, ignacio, joestakey, k, kaden, nahnah, oyc_109, rfa, robee, sach1r0, simon135, slywaters
84.4973 USDC - $84.50
!=0 is cheaper operation compared to >0, when dealing with uint.
https://github.com/code-423n4/2022-06-connext/blob/e1b2df1584dcc62dcd32a0bbcfd627fc5a0c4b7b/contracts/contracts/core/connext/facets/RelayerFacet.sol#L138 https://github.com/code-423n4/2022-06-connext/blob/e1b2df1584dcc62dcd32a0bbcfd627fc5a0c4b7b/contracts/contracts/core/connext/libraries/LibDiamond.sol#L226
Caching the array length in the stack can save gas.
https://github.com/code-423n4/2022-06-connext/blob/e1b2df1584dcc62dcd32a0bbcfd627fc5a0c4b7b/contracts/contracts/core/connext/libraries/LibDiamond.sol#L226 https://github.com/code-423n4/2022-06-connext/blob/e1b2df1584dcc62dcd32a0bbcfd627fc5a0c4b7b/contracts/contracts/core/connext/libraries/LibDiamond.sol#L228 https://github.com/code-423n4/2022-06-connext/blob/e1b2df1584dcc62dcd32a0bbcfd627fc5a0c4b7b/contracts/contracts/core/connext/libraries/LibDiamond.sol#L230 https://github.com/code-423n4/2022-06-connext/blob/e1b2df1584dcc62dcd32a0bbcfd627fc5a0c4b7b/contracts/contracts/core/connext/libraries/LibDiamond.sol#L238
Custom errors from solidity 0.8.4 are cheaper than revert strings. Source: https://blog.soliditylang.org/2021/04/21/custom-errors/:
Setting uint256 to 0 is redundant as they default to 0.