Platform: Code4rena
Start Date: 27/04/2022
Pot Size: $50,000 MIM
Total HM: 6
Participants: 59
Period: 5 days
Judge: 0xean
Id: 113
League: ETH
Rank: 33/59
Findings: 2
Award: $116.77
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x1337, 0x1f8b, 0xDjango, 0xf15ers, AuditsAreUS, BowTiedWardens, CertoraInc, Funen, GimelSec, MaratCerby, Ruhum, WatchPug, antonttc, berndartmueller, bobi, bobirichman, broccolirob, catchup, cccz, defsec, delfin454000, gs8nrv, gzeon, horsefacts, hubble, hyh, ilan, jah, joestakey, kebabsec, kenta, kenzo, m9800, mics, oyc_109, pauliax, reassor, robee, samruna, sikorico, simon135, throttle, unforgiven, z3s
72.6404 MIM - $72.64
2022-04-abranft
https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L637-L639 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L670-L672
Add the validation before for loop.
require(actions.length == values.length && values.length == datas.length, “error message”);
https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L26 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L26
Delete the above lines.
https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L238 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L218
Implement onERC721Received in the contract
#0 - cryptolyndon
2022-05-12T22:26:45Z
1 and 3 are not necessary. 2 is a good observation.
🌟 Selected for report: BowTiedWardens
Also found by: 0x1f8b, 0xNazgul, 0xf15ers, 0xkatana, CertoraInc, Funen, GimelSec, Hawkeye, IllIllI, Kulk0, NoamYakov, Tadashi, Tomio, TrungOre, antonttc, catchup, defsec, delfin454000, fatherOfBlocks, gzeon, horsefacts, joestakey, kenta, oyc_109, pauliax, reassor, robee, samruna, simon135, slywaters, sorrynotsorry, z3s
44.1284 MIM - $44.13
2022-04-abranft gas optimization
https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L739
if(_share != 0) {}
https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L494 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L527
for (uint256 k = 2; k <= COMPOUND_INTEREST_TERMS;) { // some executions unchecked { ++k; } }
https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L641 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L674
for (uint256 i; i < actions.length;) { // some executions unchecked { ++i; } }
https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L612 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L638 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L579 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L592 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L605
#0 - cryptolyndon
2022-05-13T06:01:24Z
Did you check which compiler version we use? Loop counters are unchecked. Does the optimizer really not catch things like prefix-increment and the zero comparison? Or waste cycles on "i = 0"? memory
arguments are for cook()
.
Can't dispute this until I've checked compiler output. But I remain of the opinion that these optimizations make a difference, then the compiler is broken.